Skip to content

Commit 037206e

Browse files
authored
Add files via upload
1 parent 025bb48 commit 037206e

7 files changed

Lines changed: 1282 additions & 41 deletions

File tree

compile_gegl_effects_here/gegleffectspending.c

Lines changed: 216 additions & 41 deletions
Large diffs are not rendered by default.

compile_shiny_surface_here/LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
3+
4+
5+
## Compiling and Installing
6+
7+
### Linux
8+
9+
To compile and install you will need the GEGL header files (`libgegl-dev` on
10+
Debian based distributions or `gegl` on Arch Linux) and meson (`meson` on
11+
most distributions).
12+
13+
```bash
14+
meson setup --buildtype=release build
15+
ninja -C build
16+
17+
```
18+
19+
If you have an older version of gegl you may need to copy to `~/.local/share/gegl-0.3/plug-ins`
20+
instead (on Ubuntu 18.04 for example).
21+
22+
BEAVER RECOMMENDS YOU USE A MODERN VERSION OF GEGL. NO GUARANTEE DATED VERSIONS OF GIMP WILL WORK WITH THIS PLUGIN
23+
24+
### Windows
25+
26+
The easiest way to compile this project on Windows is by using msys2. Download
27+
and install it from here: https://www.msys2.org/
28+
29+
Open a msys2 terminal with `C:\msys64\mingw64.exe`. Run the following to
30+
install required build dependencies:
31+
32+
```bash
33+
pacman --noconfirm -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-meson mingw-w64-x86_64-gegl
34+
```
35+
36+
Then build the same way you would on Linux:
37+
38+
```bash
39+
meson setup --buildtype=release build
40+
ninja -C build
41+
```
42+
43+
44+
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
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('shinytext', '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_GEGLFILTER']
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('shinytext', 'shinytext.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+
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
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+
* GEGL Shiny Text for GEGL Effects CE- Beaver 2023
18+
*/
19+
20+
#include "config.h"
21+
#include <glib/gi18n-lib.h>
22+
23+
#ifdef GEGL_PROPERTIES
24+
25+
/*
26+
Search through GEGL's source code in /operations/common to find templates.
27+
28+
Example Templates below that call gaussian blur and hsl color overlay together'
29+
*/
30+
31+
property_double (opacity, _("Opacity of Gloss Shine"), 1)
32+
description (_("Global opacity value that is always used on top of the optional auxiliary input buffer."))
33+
value_range (0.100, 1)
34+
ui_range (0.1, 1)
35+
36+
37+
38+
property_double (x_scale, _("X Scale of Gloss Shine"), 28.00)
39+
description (_("Scale value for x axis"))
40+
value_range (15, 60.0)
41+
ui_range (15, 60.0)
42+
ui_meta ("unit", "pixel-distance")
43+
ui_meta ("axis", "x")
44+
45+
property_double (y_scale, _("Y Scale of Gloss Shine"), 56.0)
46+
description (_("Scale value for y axis"))
47+
value_range (15, 150.0)
48+
ui_range (15, 150.0)
49+
ui_meta ("unit", "pixel-distance")
50+
ui_meta ("axis", "y")
51+
52+
property_double (complexity, _("Complexity of Gloss Shine"), 0.8)
53+
description (_("Complexity factor"))
54+
value_range (0.1, 0.8)
55+
56+
property_seed (seed, _("Random seed"), rand)
57+
58+
property_boolean (tiling, _("Force tiling"), TRUE)
59+
description (_("If set, the pattern generated will tile"))
60+
ui_meta ("role", "output-extent")
61+
62+
property_boolean (perturbation, _("Distorted"), TRUE)
63+
description (_("If set, the pattern will be a little more distorted"))
64+
ui_meta ("role", "output-extent")
65+
66+
property_color (color1, _("Color 1"), "#ffffff")
67+
ui_meta ("role", "output-extent")
68+
69+
property_color (color2, _("Color 2"), "#000000")
70+
ui_meta ("role", "output-extent")
71+
72+
enum_start (gegl_sinus_gloss)
73+
enum_value (GEGL_SINUS_BLEND_LINEAR , "linear", N_("Linear"))
74+
enum_value (GEGL_SINUS_BLEND_BILINEAR , "bilinear", N_("Bilinear"))
75+
enum_value (GEGL_SINUS_BLEND_SINUSOIDAL, "sinusoidal", N_("Sinusoidal"))
76+
enum_end (GeglSinusgloss)
77+
78+
79+
enum_start (gegl_blend_mode_typeshineg)
80+
enum_value (GEGL_BLEND_MODE_TYPE_GRAINMERGE, "GrainMerge",
81+
N_("GrainMerge"))
82+
enum_value (GEGL_BLEND_MODE_TYPE_HARDLIGHT, "Hardlight",
83+
N_("Hardlight"))
84+
enum_value (GEGL_BLEND_MODE_TYPE_ADDITION, "Addition",
85+
N_("Addition"))
86+
enum_value (GEGL_BLEND_MODE_TYPE_REPLACE, "Replace",
87+
N_("Replace"))
88+
enum_end (GeglBlendModeTypeshineg)
89+
90+
property_enum (blendmode, _("Blend Mode of Shine"),
91+
GeglBlendModeTypeshineg, gegl_blend_mode_typeshineg,
92+
GEGL_BLEND_MODE_TYPE_REPLACE)
93+
94+
property_boolean (enable, _("Disable Shine for GEGL Effects"), FALSE)
95+
description (_("This option is only for GEGL Effects"))
96+
ui_meta ("role", "output-extent")
97+
98+
99+
100+
101+
property_enum (sinusmode, _("Sinus Mode"),
102+
GeglSinusgloss, gegl_sinus_gloss,
103+
GEGL_SINUS_BLEND_LINEAR)
104+
ui_meta ("role", "output-extent")
105+
106+
property_double (blend_power, _("Dark to light intensity"), -0.6)
107+
description (_("Intensity of the Gloss Shine Effect"))
108+
value_range (-0.9, 0.0)
109+
110+
111+
property_int (width, _("Width"), 1024)
112+
description (_("Width of the generated buffer"))
113+
value_range (0, G_MAXINT)
114+
ui_range (0, 4096)
115+
ui_meta ("unit", "pixel-distance")
116+
ui_meta ("axis", "x")
117+
ui_meta ("role", "output-extent")
118+
119+
property_int (height, _("Height"), 768)
120+
description (_("Height of the generated buffer"))
121+
value_range (0, G_MAXINT)
122+
ui_range (0, 4096)
123+
ui_meta ("unit", "pixel-distance")
124+
ui_meta ("axis", "y")
125+
ui_meta ("role", "output-extent")
126+
127+
128+
#else
129+
130+
#define GEGL_OP_META
131+
#define GEGL_OP_NAME shinytext
132+
#define GEGL_OP_C_SOURCE shinytext.c
133+
134+
#include "gegl-op.h"
135+
136+
137+
typedef struct
138+
{
139+
GeglNode *input;
140+
GeglNode *opacity;
141+
GeglNode *nop0;
142+
GeglNode *nop;
143+
GeglNode *blend;
144+
GeglNode *sinus;
145+
GeglNode *addition;
146+
GeglNode *hardlight;
147+
GeglNode *grainmerge;
148+
GeglNode *replace;
149+
GeglNode *output;
150+
}State;
151+
152+
static void
153+
update_graph (GeglOperation *operation)
154+
{
155+
GeglProperties *o = GEGL_PROPERTIES (operation);
156+
State *state = o->user_data;
157+
if (!state) return;
158+
159+
GeglNode *blendchoice = state->replace; /* the default */
160+
switch (o->blendmode) {
161+
case GEGL_BLEND_MODE_TYPE_GRAINMERGE: blendchoice = state->grainmerge; break;
162+
case GEGL_BLEND_MODE_TYPE_HARDLIGHT: blendchoice = state->hardlight; break;
163+
case GEGL_BLEND_MODE_TYPE_ADDITION: blendchoice = state->addition; break;
164+
case GEGL_BLEND_MODE_TYPE_REPLACE: blendchoice = state->replace; break;
165+
default: blendchoice = state->replace;
166+
167+
}
168+
if (o->enable)
169+
{
170+
gegl_node_link_many (state->input, blendchoice, state->output, NULL);
171+
gegl_node_link_many (state->sinus, state->opacity, NULL);
172+
gegl_node_connect_from (blendchoice, "aux", state->opacity, "output");
173+
}
174+
else
175+
gegl_node_link_many (state->input, state->output, NULL);
176+
}
177+
178+
179+
static void attach (GeglOperation *operation)
180+
{
181+
GeglProperties *o = GEGL_PROPERTIES (operation);
182+
GeglNode *gegl = operation->node;
183+
GeglNode *input, *output, *sinus, *replace, *addition, *grainmerge, *blend, *nop0, *nop, *hardlight, *opacity;
184+
185+
186+
input = gegl_node_get_input_proxy (gegl, "input");
187+
output = gegl_node_get_output_proxy (gegl, "output");
188+
189+
190+
opacity = gegl_node_new_child (gegl,
191+
"operation", "gegl:opacity",
192+
NULL);
193+
194+
195+
sinus = gegl_node_new_child (gegl,
196+
"operation", "gegl:sinus",
197+
NULL);
198+
199+
nop = gegl_node_new_child (gegl,
200+
"operation", "gegl:nop",
201+
NULL);
202+
203+
nop0 = gegl_node_new_child (gegl,
204+
"operation", "gegl:nop",
205+
NULL);
206+
207+
208+
replace = gegl_node_new_child (gegl,
209+
"operation", "gegl:src-atop",
210+
NULL);
211+
212+
hardlight = gegl_node_new_child (gegl,
213+
"operation", "gimp:layer-mode", "layer-mode", 44, "composite-mode", 0, "blend-space", 0, NULL);
214+
215+
216+
addition = gegl_node_new_child (gegl,
217+
"operation", "gimp:layer-mode", "layer-mode", 33, "composite-mode", 0, NULL);
218+
219+
grainmerge = gegl_node_new_child (gegl,
220+
"operation", "gimp:layer-mode", "layer-mode", 47, "composite-mode", 0, NULL);
221+
222+
223+
224+
blend = gegl_node_new_child (gegl,
225+
"operation", "gegl:plus",
226+
NULL);
227+
228+
gegl_operation_meta_redirect (operation, "opacity", opacity, "value");
229+
gegl_operation_meta_redirect (operation, "seed", sinus, "seed");
230+
gegl_operation_meta_redirect (operation, "complexity", sinus, "complexity");
231+
gegl_operation_meta_redirect (operation, "x_scale", sinus, "x-scale");
232+
gegl_operation_meta_redirect (operation, "y_scale", sinus, "y-scale");
233+
gegl_operation_meta_redirect (operation, "color1", sinus, "color1");
234+
gegl_operation_meta_redirect (operation, "color2", sinus, "color2");
235+
gegl_operation_meta_redirect (operation, "blend_power", sinus, "blend-power");
236+
237+
238+
239+
240+
241+
242+
/* now save references to the gegl nodes so we can use them
243+
* later, when update_graph() is called
244+
*/
245+
State *state = g_malloc0 (sizeof (State));
246+
state->input = input;
247+
state->opacity = opacity;
248+
state->addition = addition;
249+
state->hardlight = hardlight;
250+
state->grainmerge = grainmerge;
251+
state->replace = replace;
252+
state->sinus = sinus;
253+
state->nop = nop;
254+
state->nop = nop0;
255+
state->blend = blend;
256+
state->output = output;
257+
258+
o->user_data = state;
259+
260+
}
261+
262+
263+
static void
264+
gegl_op_class_init (GeglOpClass *klass)
265+
{
266+
GeglOperationClass *operation_class;
267+
GeglOperationMetaClass *operation_meta_class = GEGL_OPERATION_META_CLASS (klass);
268+
operation_class = GEGL_OPERATION_CLASS (klass);
269+
270+
operation_class->attach = attach;
271+
operation_meta_class->update = update_graph;
272+
273+
gegl_operation_class_set_keys (operation_class,
274+
"name", "gegl:shinytext",
275+
"title", _("Shiny Text"),
276+
"categories", "hidden",
277+
"reference-hash", "sglosa28a5125700fc254001b2ac",
278+
"description", _("GEGL renders a shiny effect on text. This won't work on normal images. Only Text! Users are specified to use Gimp/GEGL blend modes and opacity slider with this"),
279+
NULL);
280+
}
281+
282+
#endif

0 commit comments

Comments
 (0)