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 "contrast.h"
5cf507fca7719ae9280d0a5199e024e920f1284dAlex Valavanis#include <Magick++.h>
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Inkscape {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Extension {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Internal {
273e421813f295d65aab512f508e8fb575d997d4gouldtjnamespace Bitmap {
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjContrast::applyEffect(Magick::Image *image) {
b8e3889c0cc57694944b28e716c44e7ecbda596bbuliabyak // the contrast method's argument seems to be binary, so we perform it multiple times
b8e3889c0cc57694944b28e716c44e7ecbda596bbuliabyak // to get the desired level of effect
b8e3889c0cc57694944b28e716c44e7ecbda596bbuliabyak for (unsigned int i = 0; i < _sharpen; i ++)
b8e3889c0cc57694944b28e716c44e7ecbda596bbuliabyak image->contrast(1);
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjContrast::refreshParameters(Inkscape::Extension::Effect *module) {
d9711532c4ac816bb0dd355f048ce0e26f542710gouldtj _sharpen = module->get_param_int("sharpen");
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj#include "../clear-n_.h"
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtjvoid
273e421813f295d65aab512f508e8fb575d997d4gouldtjContrast::init(void)
273e421813f295d65aab512f508e8fb575d997d4gouldtj{
273e421813f295d65aab512f508e8fb575d997d4gouldtj Inkscape::Extension::build_from_mem(
e4a9f366dbcb54f76b8c42869fa6873808132357gouldtj "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<name>" N_("Contrast") "</name>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "<id>org.inkscape.effect.bitmap.contrast</id>\n"
57e8d5fd57a890842b51a13207e222fcf953816cJazzyNico "<param name=\"sharpen\" gui-text=\"" N_("Adjust:") "\" type=\"int\" min=\"0\" max=\"10\">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"
b8e3889c0cc57694944b28e716c44e7ecbda596bbuliabyak "<menu-tip>" N_("Increase or decrease contrast in bitmap(s)") "</menu-tip>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "</effect>\n"
273e421813f295d65aab512f508e8fb575d997d4gouldtj "</inkscape-extension>\n", new Contrast());
273e421813f295d65aab512f508e8fb575d997d4gouldtj}
273e421813f295d65aab512f508e8fb575d997d4gouldtj
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Bitmap */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Internal */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Extension */
273e421813f295d65aab512f508e8fb575d997d4gouldtj}; /* namespace Inkscape */