unsharpmask.cpp revision d9711532c4ac816bb0dd355f048ce0e26f542710
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"
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(
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<inkscape-extension>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<name>" N_("Unsharp Mask") "</name>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<id>org.inkscape.effect.bitmap.unsharpmask</id>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<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"
d9711532c4ac816bb0dd355f048ce0e26f542710gouldtj "<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 */