~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to share/extensions/color_randomize.py

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Ted Gould, Kees Cook
  • Date: 2009-06-24 14:00:43 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624140043-07stp20mry48hqup
Tags: 0.47~pre0-0ubuntu1
* New upstream release

[ Ted Gould ]
* debian/control: Adding libgsl0 and removing version specifics on boost

[ Kees Cook ]
* debian/watch: updated to run uupdate and mangle pre-release versions.
* Dropped patches that have been taken upstream:
  - 01_mips
  - 02-poppler-0.8.3
  - 03-chinese-inkscape
  - 05_fix_latex_patch
  - 06_gcc-4.4
  - 07_cdr2svg
  - 08_skip-bad-utf-on-pdf-import
  - 09_gtk-clist
  - 10_belarussian
  - 11_libpng
  - 12_desktop
  - 13_slider
  - 100_svg_import_improvements
  - 102_sp_pattern_painter_free
  - 103_bitmap_type_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import coloreffect,random,inkex
2
 
 
3
 
class C(coloreffect.ColorEffect):
4
 
    def __init__(self):
5
 
        coloreffect.ColorEffect.__init__(self)
6
 
        self.OptionParser.add_option("-x", "--hue",
7
 
            action="store", type="inkbool", 
8
 
            dest="hue", default=True,
9
 
            help="randomize hue")
10
 
        self.OptionParser.add_option("-s", "--saturation",
11
 
            action="store", type="inkbool", 
12
 
            dest="saturation", default=True,
13
 
            help="randomize saturation")
14
 
        self.OptionParser.add_option("-l", "--lightness",
15
 
            action="store", type="inkbool", 
16
 
            dest="lightness", default=True,
17
 
            help="randomize lightness")
18
 
 
19
 
    def colmod(self,r,g,b):
20
 
        hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)
21
 
        if(self.options.hue):
22
 
            hsl[0]=random.random()
23
 
        if(self.options.saturation):
24
 
            hsl[1]=random.random()
25
 
        if(self.options.lightness):
26
 
            hsl[2]=random.random()
27
 
        rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])
28
 
        return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)
29
 
 
30
 
c = C()
31
 
c.affect()
 
 
b'\\ No newline at end of file'
 
1
import coloreffect,random,inkex
 
2
 
 
3
class C(coloreffect.ColorEffect):
 
4
    def __init__(self):
 
5
        coloreffect.ColorEffect.__init__(self)
 
6
        self.OptionParser.add_option("-x", "--hue",
 
7
            action="store", type="inkbool", 
 
8
            dest="hue", default=True,
 
9
            help="randomize hue")
 
10
        self.OptionParser.add_option("-s", "--saturation",
 
11
            action="store", type="inkbool", 
 
12
            dest="saturation", default=True,
 
13
            help="randomize saturation")
 
14
        self.OptionParser.add_option("-l", "--lightness",
 
15
            action="store", type="inkbool", 
 
16
            dest="lightness", default=True,
 
17
            help="randomize lightness")
 
18
 
 
19
    def colmod(self,r,g,b):
 
20
        hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)
 
21
        if(self.options.hue):
 
22
            hsl[0]=random.random()
 
23
        if(self.options.saturation):
 
24
            hsl[1]=random.random()
 
25
        if(self.options.lightness):
 
26
            hsl[2]=random.random()
 
27
        rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])
 
28
        return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)
 
29
 
 
30
c = C()
 
31
c.affect()
 
32
 
 
33
 
 
34
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99