~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/extension/internal/bitmap/colorize.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Authors:
 
3
 *   Christopher Brown <audiere@gmail.com>
 
4
 *   Ted Gould <ted@gould.cx>
 
5
 *
 
6
 * Copyright (C) 2007 Authors
 
7
 *
 
8
 * Released under GNU GPL, read the file 'COPYING' for more information
 
9
 */
 
10
 
 
11
#include "extension/effect.h"
 
12
#include "extension/system.h"
 
13
 
 
14
#include "colorize.h"
 
15
 
 
16
#include "color.h"
 
17
 
 
18
#include <iostream>
 
19
 
 
20
namespace Inkscape {
 
21
namespace Extension {
 
22
namespace Internal {
 
23
namespace Bitmap {
 
24
        
 
25
void
 
26
Colorize::applyEffect(Magick::Image *image) {
 
27
        float r = ((_color >> 24) & 0xff) / 255.0F;
 
28
        float g = ((_color >> 16) & 0xff) / 255.0F;
 
29
        float b = ((_color >>  8) & 0xff) / 255.0F;
 
30
        float a = ((_color      ) & 0xff) / 255.0F;
 
31
        
 
32
    Magick::ColorRGB mc(r,g,b);
 
33
        
 
34
        image->colorize(a * 100, mc);
 
35
}
 
36
 
 
37
void
 
38
Colorize::refreshParameters(Inkscape::Extension::Effect *module) {      
 
39
        _color = module->get_param_color("color");
 
40
}
 
41
 
 
42
#include "../clear-n_.h"
 
43
 
 
44
void
 
45
Colorize::init(void)
 
46
{
 
47
        Inkscape::Extension::build_from_mem(
 
48
                "<inkscape-extension>\n"
 
49
                        "<name>" N_("Colorize") "</name>\n"
 
50
                        "<id>org.inkscape.effect.bitmap.colorize</id>\n"
 
51
                        "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">0</param>\n"
 
52
                        "<effect>\n"
 
53
                                "<object-type>all</object-type>\n"
 
54
                                "<effects-menu>\n"
 
55
                                        "<submenu name=\"" N_("Raster") "\" />\n"
 
56
                                "</effects-menu>\n"
 
57
                                "<menu-tip>" N_("Colorize selected bitmap(s) with specified color, using given opacity.") "</menu-tip>\n"
 
58
                        "</effect>\n"
 
59
                "</inkscape-extension>\n", new Colorize());
 
60
}
 
61
 
 
62
}; /* namespace Bitmap */
 
63
}; /* namespace Internal */
 
64
}; /* namespace Extension */
 
65
}; /* namespace Inkscape */