|
| 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 | + */ |
| 18 | + |
| 19 | +#include "config.h" |
| 20 | +#include <glib/gi18n-lib.h> |
| 21 | + |
| 22 | +#ifdef GEGL_PROPERTIES |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +property_double (radius1, _("Radius"), 7.0) |
| 27 | + value_range (1.0, 40.0) |
| 28 | + ui_range (1.0, 12) |
| 29 | + ui_gamma (1.5) |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +property_double (bevel1, _("Depth Angle"), 90.0) |
| 34 | + description (_("Elevation angle (degrees)")) |
| 35 | + value_range (0, 180) |
| 36 | + ui_meta ("unit", "degree") |
| 37 | + |
| 38 | +property_int (bevel2, _("Depth"), 40) |
| 39 | + description (_("Filter width")) |
| 40 | + value_range (1, 100) |
| 41 | + |
| 42 | + |
| 43 | +property_double (th, _("Threshold of the Bevel's Transparency'"), 0.100) |
| 44 | + value_range (0.0, 1.0) |
| 45 | + ui_range (0.0, 0.5) |
| 46 | + |
| 47 | +property_double (azimuth, _("Rotate Lighting"), 40.0) |
| 48 | + description (_("Light angle (degrees)")) |
| 49 | + value_range (0, 350) |
| 50 | + ui_meta ("unit", "degree") |
| 51 | + ui_meta ("direction", "ccw") |
| 52 | + |
| 53 | + |
| 54 | +#else |
| 55 | + |
| 56 | +#define GEGL_OP_META |
| 57 | +#define GEGL_OP_NAME bevel |
| 58 | +#define GEGL_OP_C_SOURCE bevel.c |
| 59 | + |
| 60 | +#include "gegl-op.h" |
| 61 | + |
| 62 | +static void attach (GeglOperation *operation) |
| 63 | +{ |
| 64 | + GeglNode *gegl = operation->node; |
| 65 | + GeglNode *input, *output, *blur, *emb, *th; |
| 66 | + |
| 67 | + input = gegl_node_get_input_proxy (gegl, "input"); |
| 68 | + output = gegl_node_get_output_proxy (gegl, "output"); |
| 69 | + |
| 70 | + blur = gegl_node_new_child (gegl, |
| 71 | + "operation", "gegl:gaussian-blur", |
| 72 | + NULL); |
| 73 | + |
| 74 | + |
| 75 | + emb = gegl_node_new_child (gegl, |
| 76 | + "operation", "gegl:emboss", |
| 77 | + NULL); |
| 78 | + |
| 79 | + th = gegl_node_new_child (gegl, |
| 80 | + "operation", "gimp:threshold-alpha", |
| 81 | + NULL); |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + gegl_node_link_many (input, blur, emb, th, output, NULL); |
| 86 | + |
| 87 | + gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-x"); |
| 88 | + gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-y"); |
| 89 | + |
| 90 | + gegl_operation_meta_redirect (operation, "bevelhidden", emb, ""); |
| 91 | + |
| 92 | + gegl_operation_meta_redirect (operation, "bevel1", emb, "elevation"); |
| 93 | + |
| 94 | + gegl_operation_meta_redirect (operation, "bevel2", emb, "depth"); |
| 95 | + |
| 96 | + gegl_operation_meta_redirect (operation, "azimuth", emb, "azimuth"); |
| 97 | + |
| 98 | + |
| 99 | + gegl_operation_meta_redirect (operation, "th", th, "value"); |
| 100 | + |
| 101 | + |
| 102 | +} |
| 103 | + |
| 104 | +static void |
| 105 | +gegl_op_class_init (GeglOpClass *klass) |
| 106 | +{ |
| 107 | + GeglOperationClass *operation_class; |
| 108 | + |
| 109 | + operation_class = GEGL_OPERATION_CLASS (klass); |
| 110 | + |
| 111 | + operation_class->attach = attach; |
| 112 | + |
| 113 | + gegl_operation_class_set_keys (operation_class, |
| 114 | + "name", "gegl:bevel", |
| 115 | + "title", _("Bevel"), |
| 116 | + "categories", "Aristic", |
| 117 | + "reference-hash", "45ed5656a28a512570f0f25sb2ac", |
| 118 | + "description", _("Bevel Images using GEGL. Use the multiply blend mode " |
| 119 | + ""), |
| 120 | + NULL); |
| 121 | +} |
| 122 | + |
| 123 | +#endif |
0 commit comments