diff options
| author | Jos Hirth <github@kaioa.com> | 2007-08-13 20:07:36 +0000 |
|---|---|---|
| committer | amphi <amphi@users.sourceforge.net> | 2007-08-13 20:07:36 +0000 |
| commit | b684b706cc557063e0d3502e577b30816412b4f3 (patch) | |
| tree | 6ea7fa131b0534cd917dd9a10598fbc169d70980 /share | |
| parent | Added a clip path stack for PdfParser and a node stack for SvgBuilder needed ... (diff) | |
| download | inkscape-b684b706cc557063e0d3502e577b30816412b4f3.tar.gz inkscape-b684b706cc557063e0d3502e577b30816412b4f3.zip | |
color_randomize added
(bzr r3459)
Diffstat (limited to 'share')
| -rw-r--r-- | share/extensions/Makefile.am | 2 | ||||
| -rw-r--r-- | share/extensions/color_randomize.inx | 19 | ||||
| -rw-r--r-- | share/extensions/color_randomize.py | 31 |
3 files changed, 52 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index af31e6777..b1cda326b 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -26,6 +26,7 @@ extensions = \ color_morelight.py\ color_moresaturation.py\ color_negative.py\ + color_randomize.py\ color_removeblue.py\ color_removegreen.py\ color_removered.py\ @@ -118,6 +119,7 @@ modules = \ color_morelight.inx\ color_moresaturation.inx\ color_negative.inx\ + color_randomize.py\ color_removeblue.inx\ color_removegreen.inx\ color_removered.inx\ diff --git a/share/extensions/color_randomize.inx b/share/extensions/color_randomize.inx new file mode 100644 index 000000000..c92bef4f2 --- /dev/null +++ b/share/extensions/color_randomize.inx @@ -0,0 +1,19 @@ +<inkscape-extension>
+ <_name>Randomize</_name>
+ <id>org.inkscape.color.randomize</id>
+ <dependency type="executable" location="extensions">coloreffect.py</dependency>
+ <dependency type="executable" location="extensions">color_randomize.py</dependency>
+ <dependency type="executable" location="extensions">simplestyle.py</dependency>
+ <param name="hue" type="boolean" _gui-text="Hue">true</param>
+ <param name="saturation" type="boolean" _gui-text="Saturation">true</param>
+ <param name="lightness" type="boolean" _gui-text="Lightness">true</param>
+ <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Color"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">color_randomize.py</command>
+ </script>
+</inkscape-extension>
\ No newline at end of file diff --git a/share/extensions/color_randomize.py b/share/extensions/color_randomize.py new file mode 100644 index 000000000..4591675b5 --- /dev/null +++ b/share/extensions/color_randomize.py @@ -0,0 +1,31 @@ +import coloreffect,random,inkex
+
+class C(coloreffect.ColorEffect):
+ def __init__(self):
+ coloreffect.ColorEffect.__init__(self)
+ self.OptionParser.add_option("-x", "--hue",
+ action="store", type="inkbool",
+ dest="hue", default=True,
+ help="randomize hue")
+ self.OptionParser.add_option("-s", "--saturation",
+ action="store", type="inkbool",
+ dest="saturation", default=True,
+ help="randomize saturation")
+ self.OptionParser.add_option("-l", "--lightness",
+ action="store", type="inkbool",
+ dest="lightness", default=True,
+ help="randomize lightness")
+
+ def colmod(self,r,g,b):
+ hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)
+ if(self.options.hue):
+ hsl[0]=random.random()
+ if(self.options.saturation):
+ hsl[1]=random.random()
+ if(self.options.lightness):
+ hsl[2]=random.random()
+ rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])
+ return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)
+
+c = C()
+c.affect()
\ No newline at end of file |
