273e421813f295d65aab512f508e8fb575d997d4gouldtj/*
273e421813f295d65aab512f508e8fb575d997d4gouldtj * Copyright (C) 2007 Authors:
273e421813f295d65aab512f508e8fb575d997d4gouldtj * Christopher Brown <audiere@gmail.com>
273e421813f295d65aab512f508e8fb575d997d4gouldtj * Ted Gould <ted@gould.cx>
273e421813f295d65aab512f508e8fb575d997d4gouldtj *
273e421813f295d65aab512f508e8fb575d997d4gouldtj * Released under GNU GPL, read the file 'COPYING' for more information
273e421813f295d65aab512f508e8fb575d997d4gouldtj */
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj#include "extension/effect.h"
273e421813f295d65aab512f508e8fb575d997d4gouldtj#include "extension/system.h"
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj#include "unsharpmask.h"
5cf507fca7719ae9280d0a5199e024e920f1284dAlex Valavanis#include <Magick++.h>
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Inkscape {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Extension {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Internal {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Bitmap {
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjUnsharpmask::applyEffect(Magick::Image* image) {
273e421813f295d65aab512f508e8fb575d997d4gouldtj float amount = _amount / 100.0;
273e421813f295d65aab512f508e8fb575d997d4gouldtj image->unsharpmask(_radius, _sigma, amount, _threshold);
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjUnsharpmask::refreshParameters(Inkscape::Extension::Effect* module) {
273e421813f295d65aab512f508e8fb575d997d4gouldtj _radius = module->get_param_float("radius");
273e421813f295d65aab512f508e8fb575d997d4gouldtj _sigma = module->get_param_float("sigma");
273e421813f295d65aab512f508e8fb575d997d4gouldtj _amount = module->get_param_float("amount");
273e421813f295d65aab512f508e8fb575d997d4gouldtj _threshold = module->get_param_float("threshold");
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj#include "../clear-n_.h"
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjUnsharpmask::init(void)
273e421813f295d65aab512f508e8fb575d997d4gouldtj{
273e421813f295d65aab512f508e8fb575d997d4gouldtj Inkscape::Extension::build_from_mem(
e4a9f366dbcb54f76b8c42869fa6873808132357gouldtj "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<name>" N_("Unsharp Mask") "</name>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<id>org.inkscape.effect.bitmap.unsharpmask</id>\n"
57e8d5fd57a890842b51a13207e222fcf953816cJazzyNico "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
57e8d5fd57a890842b51a13207e222fcf953816cJazzyNico "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
57e8d5fd57a890842b51a13207e222fcf953816cJazzyNico "<param name=\"amount\" gui-text=\"" N_("Amount:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n"
57e8d5fd57a890842b51a13207e222fcf953816cJazzyNico "<param name=\"threshold\" gui-text=\"" N_("Threshold:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<effect>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<object-type>all</object-type>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<effects-menu>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<submenu name=\"" N_("Raster") "\" />\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "</effects-menu>\n"
3a056a63fe247049cb6f63423493697452752802Kris "<menu-tip>" N_("Sharpen selected bitmap(s) using unsharp mask algorithms") "</menu-tip>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "</effect>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "</inkscape-extension>\n", new Unsharpmask());
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Bitmap */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Internal */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Extension */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Inkscape */