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 "shade.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)22Shade::applyEffect(Magick::Image* image) { 23 image->shade(_azimuth, _elevation, !_colorShading); 24 // I don't know why, but I have to invert colorShading here 25 } 26 27 void refreshParameters(Inkscape::Extension::Effect * module)28Shade::refreshParameters(Inkscape::Extension::Effect* module) { 29 _azimuth = module->get_param_float("azimuth"); 30 _elevation = module->get_param_float("elevation"); 31 _colorShading = module->get_param_bool("colorShading"); 32 } 33 34 #include "../clear-n_.h" 35 36 void init()37Shade::init() 38 { 39 // clang-format off 40 Inkscape::Extension::build_from_mem( 41 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" 42 "<name>" N_("Shade") "</name>\n" 43 "<id>org.inkscape.effect.bitmap.shade</id>\n" 44 "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" 45 "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" 46 "<param name=\"colorShading\" gui-text=\"" N_("Colored Shading") "\" type=\"bool\">false</param>\n" 47 "<effect>\n" 48 "<object-type>all</object-type>\n" 49 "<effects-menu>\n" 50 "<submenu name=\"" N_("Raster") "\" />\n" 51 "</effects-menu>\n" 52 "<menu-tip>" N_("Shade selected bitmap(s) simulating distant light source") "</menu-tip>\n" 53 "</effect>\n" 54 "</inkscape-extension>\n", new Shade()); 55 // clang-format on 56 } 57 58 }; /* namespace Bitmap */ 59 }; /* namespace Internal */ 60 }; /* namespace Extension */ 61 }; /* namespace Inkscape */ 62