diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2010-02-14 09:46:42 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2010-02-14 09:46:42 +0000 |
| commit | 18a9812ccd9818b0cb0ac66979bd90243ab7a68f (patch) | |
| tree | 37ef6cc292d35cbd4811872733f5bc5f732e0f65 | |
| parent | Implementation of snap delay mechanism for guides (diff) | |
| download | inkscape-18a9812ccd9818b0cb0ac66979bd90243ab7a68f.tar.gz inkscape-18a9812ccd9818b0cb0ac66979bd90243ab7a68f.zip | |
Extensions. New black and white color extension.
Fixed bugs:
- https://launchpad.net/bugs/518429
(bzr r9089)
| -rw-r--r-- | share/extensions/Makefile.am | 2 | ||||
| -rw-r--r-- | share/extensions/color_blackandwhite.inx | 17 | ||||
| -rw-r--r-- | share/extensions/color_blackandwhite.py | 17 |
3 files changed, 36 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 110522895..c40ba1c87 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -18,6 +18,7 @@ extensions = \ addnodes.py \ bezmisc.py \ chardataeffect.py\ + color_blackandwhite.py\ color_brighter.py\ color_custom.py\ color_darker.py\ @@ -154,6 +155,7 @@ modules = \ cdt_input.inx \ cgm_input.inx \ cmx_input.inx \ + color_blackandwhite.inx\ color_brighter.inx\ color_custom.inx \ color_darker.inx\ diff --git a/share/extensions/color_blackandwhite.inx b/share/extensions/color_blackandwhite.inx new file mode 100644 index 000000000..8432ab2d3 --- /dev/null +++ b/share/extensions/color_blackandwhite.inx @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <_name>Black and White</_name> + <id>org.inkscape.color.blackandwhite</id> + <dependency type="executable" location="extensions">coloreffect.py</dependency> + <dependency type="executable" location="extensions">color_blackandwhite.py</dependency> + <dependency type="executable" location="extensions">simplestyle.py</dependency> + <effect> + <object-type>all</object-type> + <effects-menu> + <submenu _name="Color"/> + </effects-menu> + </effect> + <script> + <command reldir="extensions" interpreter="python">color_blackandwhite.py</command> + </script> +</inkscape-extension> diff --git a/share/extensions/color_blackandwhite.py b/share/extensions/color_blackandwhite.py new file mode 100644 index 000000000..c11b2a127 --- /dev/null +++ b/share/extensions/color_blackandwhite.py @@ -0,0 +1,17 @@ +import coloreffect,sys + +class C(coloreffect.ColorEffect): + def colmod(self,r,g,b): + #ITU-R Recommendation BT.709 + #l = 0.2125 * r + 0.7154 * g + 0.0721 * b + #NTSC and PAL + l = 0.299 * r + 0.587 * g + 0.114 * b + if l > 127: + ig = 255 + else: + ig = 0 + #coloreffect.debug('gs '+hex(r)+' '+hex(g)+' '+hex(b)+'%02x%02x%02x' % (ig,ig,ig)) + return '%02x%02x%02x' % (ig,ig,ig) + +c = C() +c.affect() |
