1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2007 Authors:
4  *   Christopher Brown <audiere@gmail.com>
5  *   Ted Gould <ted@gould.cx>
6  *
7  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
8  */
9 
10 #include "extension/effect.h"
11 #include "extension/system.h"
12 
13 #include "solarize.h"
14 #include <Magick++.h>
15 
16 namespace Inkscape {
17 namespace Extension {
18 namespace Internal {
19 namespace Bitmap {
20 
21 void
applyEffect(Magick::Image * image)22 Solarize::applyEffect(Magick::Image* image) {
23     // Image Magick Quantum depth = 16
24     // 655.35 = (2^16 - 1) / 100
25 	image->solarize(_factor * 655.35);
26 }
27 
28 void
refreshParameters(Inkscape::Extension::Effect * module)29 Solarize::refreshParameters(Inkscape::Extension::Effect* module) {
30 	_factor = module->get_param_float("factor");
31 }
32 
33 #include "../clear-n_.h"
34 
35 void
init()36 Solarize::init()
37 {
38     // clang-format off
39     Inkscape::Extension::build_from_mem(
40         "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
41             "<name>" N_("Solarize") "</name>\n"
42             "<id>org.inkscape.effect.bitmap.solarize</id>\n"
43             "<param name=\"factor\" gui-text=\"" N_("Factor:") "\" type=\"float\" min=\"0\" max=\"100\">50</param>\n"
44             "<effect>\n"
45                 "<object-type>all</object-type>\n"
46                 "<effects-menu>\n"
47                     "<submenu name=\"" N_("Raster") "\" />\n"
48                 "</effects-menu>\n"
49                 "<menu-tip>" N_("Solarize selected bitmap(s), like overexposing photographic film") "</menu-tip>\n"
50             "</effect>\n"
51         "</inkscape-extension>\n", new Solarize());
52     // clang-format on
53 }
54 
55 }; /* namespace Bitmap */
56 }; /* namespace Internal */
57 }; /* namespace Extension */
58 }; /* namespace Inkscape */
59