Code

add hsl adjusters; remove keep-rgb as redundant; update uris
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 18 Nov 2006 18:08:42 +0000 (18:08 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 18 Nov 2006 18:08:42 +0000 (18:08 +0000)
30 files changed:
share/extensions/Makefile.am
share/extensions/color_brighter.inx
share/extensions/color_custom.inx
share/extensions/color_darker.inx
share/extensions/color_desaturate.inx
share/extensions/color_grayscale.inx
share/extensions/color_keepblue.inx [deleted file]
share/extensions/color_keepblue.py [deleted file]
share/extensions/color_keepgreen.inx [deleted file]
share/extensions/color_keepgreen.py [deleted file]
share/extensions/color_keepred.inx [deleted file]
share/extensions/color_keepred.py [deleted file]
share/extensions/color_lesshue.inx [new file with mode: 0644]
share/extensions/color_lesshue.py [new file with mode: 0644]
share/extensions/color_lesslight.inx [new file with mode: 0644]
share/extensions/color_lesslight.py [new file with mode: 0644]
share/extensions/color_lesssaturation.inx [new file with mode: 0644]
share/extensions/color_lesssaturation.py [new file with mode: 0644]
share/extensions/color_morehue.inx [new file with mode: 0644]
share/extensions/color_morehue.py [new file with mode: 0644]
share/extensions/color_morelight.inx [new file with mode: 0644]
share/extensions/color_morelight.py [new file with mode: 0644]
share/extensions/color_moresaturation.inx [new file with mode: 0644]
share/extensions/color_moresaturation.py [new file with mode: 0644]
share/extensions/color_negative.inx
share/extensions/color_removeblue.inx
share/extensions/color_removegreen.inx
share/extensions/color_removered.inx
share/extensions/color_rgbbarrel.inx
share/extensions/coloreffect.py

index bc0c0b49f9ef0d3d064a22dbde891499fc2a3fa4..cbcba7f892954f8576b69fb17f65a621c44fa3e0 100644 (file)
@@ -70,14 +70,17 @@ extensions = \
        color_grayscale.py\
        color_brighter.py\
        color_darker.py\
-       color_keepblue.py\
-       color_keepgreen.py\
-       color_keepred.py\
        color_negative.py\
        color_removeblue.py\
        color_removegreen.py\
        color_removered.py\
-       color_rgbbarrel.py
+       color_rgbbarrel.py\
+       color_moresaturation.py\
+       color_lesssaturation.py\
+       color_morelight.py\
+       color_lesslight.py\
+       color_morehue.py\
+       color_lesshue.py
 
 
 otherstuff = \
@@ -145,14 +148,17 @@ modules = \
        color_desaturate.inx\
        color_grayscale.inx\
        color_negative.inx\
-       color_keepblue.inx\
-       color_keepgreen.inx\
-       color_keepred.inx\
        color_removeblue.inx\
        color_removegreen.inx\
        color_removered.inx\
        color_rgbbarrel.inx\
-       color_custom.inx 
+       color_custom.inx \
+       color_moresaturation.inx\
+       color_lesssaturation.inx\
+       color_morelight.inx\
+       color_lesslight.inx\
+       color_morehue.inx\
+       color_lesshue.inx
 
 
 extension_SCRIPTS = \
index adc34410d41a230e4098ece7619d3ee4eea34530..48c7f5c91f8ffdc86a6dbfc22b65987b406350fe 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Brighter</_name>\r
-       <id>com.kaioa.brighter</id>\r
+       <id>org.inkscape.color.brighter</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_brighter.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index 8ba2cd520713548448635a8a71f938fa9d6f477d..647caade702016deb2ec019803bdfccaa1ca9f43 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
-       <_name>Custom</_name>\r
-       <id>com.kaioa.zcustom</id>\r
+       <_name>Custom...</_name>\r
+       <id>org.inkscape.color.custom</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_custom.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index aa937adc1a07369088ba3e3b53961e6103113387..0408c788e829602e4e19c9a2c5e4c4beb0700b96 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Darker</_name>\r
-       <id>com.kaioa.darker</id>\r
+       <id>org.inkscape.color.darker</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_darker.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index 2aa6c020150734dac9732705debe9ffbd781cc5a..5e25db5255c45071b639434b9165e52008b75a92 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Desaturate</_name>\r
-       <id>com.kaioa.desaturate</id>\r
+       <id>org.inkscape.color.desaturate</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_desaturate.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index 495a3aa189b9d781b3a177cd51cc5e2e98de74c7..d90ea8f3ed8e10a18e69ec19fcdc3dd6661b8423 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Grayscale</_name>\r
-       <id>com.kaioa.grayscale</id>\r
+       <id>org.inkscape.color.grayscale</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_grayscale.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
diff --git a/share/extensions/color_keepblue.inx b/share/extensions/color_keepblue.inx
deleted file mode 100644 (file)
index 900f555..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<inkscape-extension>\r
-       <_name>Keep Blue</_name>\r
-       <id>com.kaioa.keepblue</id>\r
-       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
-       <dependency type="executable" location="extensions">color_keepblue.py</dependency>\r
-       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
-       <effect>\r
-               <object-type>all</object-type>\r
-               <effects-menu>\r
-                       <submenu _name="Color"/>\r
-               </effects-menu>\r
-       </effect>\r
-       <script>\r
-               <command reldir="extensions" interpreter="python">color_keepblue.py</command>\r
-       </script>\r
-</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_keepblue.py b/share/extensions/color_keepblue.py
deleted file mode 100644 (file)
index 205a879..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-import coloreffect\r
-\r
-class C(coloreffect.ColorEffect):\r
-  def colmod(self,r,g,b):\r
-    return '%02x%02x%02x' % (0,0,b)\r
-\r
-c = C()\r
-c.affect()
\ No newline at end of file
diff --git a/share/extensions/color_keepgreen.inx b/share/extensions/color_keepgreen.inx
deleted file mode 100644 (file)
index 0ee1ddd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<inkscape-extension>\r
-       <_name>Keep Green</_name>\r
-       <id>com.kaioa.keepgreen</id>\r
-       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
-       <dependency type="executable" location="extensions">color_keepgreen.py</dependency>\r
-       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
-       <effect>\r
-               <object-type>all</object-type>\r
-               <effects-menu>\r
-                       <submenu _name="Color"/>\r
-               </effects-menu>\r
-       </effect>\r
-       <script>\r
-               <command reldir="extensions" interpreter="python">color_keepgreen.py</command>\r
-       </script>\r
-</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_keepgreen.py b/share/extensions/color_keepgreen.py
deleted file mode 100644 (file)
index 3da5e45..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-import coloreffect\r
-\r
-class C(coloreffect.ColorEffect):\r
-  def colmod(self,r,g,b):\r
-    return '%02x%02x%02x' % (0,g,0)\r
-\r
-c = C()\r
-c.affect()
\ No newline at end of file
diff --git a/share/extensions/color_keepred.inx b/share/extensions/color_keepred.inx
deleted file mode 100644 (file)
index 824fa2b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<inkscape-extension>\r
-       <_name>Keep Red</_name>\r
-       <id>com.kaioa.keepred</id>\r
-       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
-       <dependency type="executable" location="extensions">color_keepred.py</dependency>\r
-       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
-       <effect>\r
-               <object-type>all</object-type>\r
-               <effects-menu>\r
-                       <submenu _name="Color"/>\r
-               </effects-menu>\r
-       </effect>\r
-       <script>\r
-               <command reldir="extensions" interpreter="python">color_keepred.py</command>\r
-       </script>\r
-</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_keepred.py b/share/extensions/color_keepred.py
deleted file mode 100644 (file)
index 662e521..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-import coloreffect\r
-\r
-class C(coloreffect.ColorEffect):\r
-  def colmod(self,r,g,b):\r
-    return '%02x%02x%02x' % (r,0,0)\r
-\r
-c = C()\r
-c.affect()
\ No newline at end of file
diff --git a/share/extensions/color_lesshue.inx b/share/extensions/color_lesshue.inx
new file mode 100644 (file)
index 0000000..4533026
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>Less Hue</_name>\r
+       <id>org.inkscape.color.lesshue</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_lesshue.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_lesshue.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_lesshue.py b/share/extensions/color_lesshue.py
new file mode 100644 (file)
index 0000000..74ac5ae
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[0] = hsl[0] - 0.05
+    if hsl[0] < 0.0:\r
+        hsl[0] = 1.0 + hsl[0]                  \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
diff --git a/share/extensions/color_lesslight.inx b/share/extensions/color_lesslight.inx
new file mode 100644 (file)
index 0000000..bf09892
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>Less Light</_name>\r
+       <id>org.inkscape.color.lesslight</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_lesslight.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_lesslight.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_lesslight.py b/share/extensions/color_lesslight.py
new file mode 100644 (file)
index 0000000..6f912f0
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[2] = hsl[2] - 0.05
+    if hsl[2] < 0.0:\r
+        hsl[2] = 0.0                   \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
diff --git a/share/extensions/color_lesssaturation.inx b/share/extensions/color_lesssaturation.inx
new file mode 100644 (file)
index 0000000..aa96cf1
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>Less Saturation</_name>\r
+       <id>org.inkscape.color.lesssaturation</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_lesssaturation.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_lesssaturation.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_lesssaturation.py b/share/extensions/color_lesssaturation.py
new file mode 100644 (file)
index 0000000..422a019
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[1] = hsl[1] - 0.05
+    if hsl[1] < 0.0:\r
+        hsl[1] = 0.0                   \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
diff --git a/share/extensions/color_morehue.inx b/share/extensions/color_morehue.inx
new file mode 100644 (file)
index 0000000..76300ab
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>More Hue</_name>\r
+       <id>org.inkscape.color.morehue</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_morehue.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_morehue.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_morehue.py b/share/extensions/color_morehue.py
new file mode 100644 (file)
index 0000000..bc25274
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[0] = hsl[0] + 0.05
+    if hsl[0] > 1.0:\r
+        hsl[0] = hsl[0] - 1.0                  \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
diff --git a/share/extensions/color_morelight.inx b/share/extensions/color_morelight.inx
new file mode 100644 (file)
index 0000000..8b97adf
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>More Light</_name>\r
+       <id>org.inkscape.color.morelight</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_morelight.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_morelight.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_morelight.py b/share/extensions/color_morelight.py
new file mode 100644 (file)
index 0000000..483af7f
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[2] = hsl[2] + 0.05
+    if hsl[2] > 1.0:\r
+        hsl[2] = 1.0                   \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
diff --git a/share/extensions/color_moresaturation.inx b/share/extensions/color_moresaturation.inx
new file mode 100644 (file)
index 0000000..0c4a0bf
--- /dev/null
@@ -0,0 +1,16 @@
+<inkscape-extension>\r
+       <_name>More Saturation</_name>\r
+       <id>org.inkscape.color.moresaturation</id>\r
+       <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+       <dependency type="executable" location="extensions">color_moresaturation.py</dependency>\r
+       <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+       <effect>\r
+               <object-type>all</object-type>\r
+               <effects-menu>\r
+                       <submenu _name="Color"/>\r
+               </effects-menu>\r
+       </effect>\r
+       <script>\r
+               <command reldir="extensions" interpreter="python">color_moresaturation.py</command>\r
+       </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_moresaturation.py b/share/extensions/color_moresaturation.py
new file mode 100644 (file)
index 0000000..2ae7f33
--- /dev/null
@@ -0,0 +1,14 @@
+import coloreffect, inkex\r
+\r
+class C(coloreffect.ColorEffect):\r
+  def colmod(self,r,g,b):\r
+    hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)\r
+    #inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))\r
+    hsl[1] = hsl[1] + 0.05
+    if hsl[1] > 1.0:\r
+        hsl[1] = 1.0                   \r
+    rgb = self.hsl_to_rgb(hsl[0], hsl[1], hsl[2])\r
+    return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255)\r
+\r
+c = C()\r
+c.affect()\r
index 7dc73c3ccea9ecc21d0ab9c8169b090bf2de73e9..bdf0f4cb0923da1dfa1c1c612a9a6a22d4bbe9b5 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Negative</_name>\r
-       <id>com.kaioa.negative</id>\r
+       <id>org.inkscape.color.negative</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_negative.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index 2dadb5a5385cacc038b3a794a2c6f9a73176eb4d..db3062ff5505870060bf5149bf2563b26d16f5ac 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Remove Blue</_name>\r
-       <id>com.kaioa.removeblue</id>\r
+       <id>org.inkscape.color.removeblue</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_removeblue.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index 13ea8666b7be0d95524047ae25fce3db81424f0e..2e70dea294bf4f45f8ead137511a822c898c6964 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Remove Green</_name>\r
-       <id>com.kaioa.removegreen</id>\r
+       <id>org.inkscape.color.removegreen</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_removegreen.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index ef74410d7ae67ca43434ad5ae4a2482f4d8378ee..1565fc676b73de33fe74c3611d8a89a354a4a665 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>Remove Red</_name>\r
-       <id>com.kaioa.removered</id>\r
+       <id>org.inkscape.color.removered</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_removered.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index a676dae858a3d55d1198195f5d05dd0dd29d13eb..79d2fbc7d1e56b8ef472189ee699eaf3ad072bb0 100644 (file)
@@ -1,6 +1,6 @@
 <inkscape-extension>\r
        <_name>RGB Barrel</_name>\r
-       <id>com.kaioa.rgbbarrel</id>\r
+       <id>org.inkscape.color.rgbbarrel</id>\r
        <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
        <dependency type="executable" location="extensions">color_rgbbarrel.py</dependency>\r
        <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
index c1ed150659f5345a97c4c8782b4e317474fb27f0..6881994750e2c767526c76847caf6cf2df67815f 100644 (file)
@@ -24,6 +24,7 @@ color_props_fill=('fill:','stop-color:','flood-color:','lighting-color:')
 color_props_stroke=('stroke:',)\r
 color_props = color_props_fill + color_props_stroke\r
 \r
+\r
 class ColorEffect(inkex.Effect):\r
   def __init__(self):\r
     inkex.Effect.__init__(self,use_minidom=True)\r
@@ -105,3 +106,62 @@ class ColorEffect(inkex.Effect):
  \r
   def colmod(self,r,g,b):\r
     pass\r
+\r
+  def rgb_to_hsl(self,r, g, b):\r
+    rgb_max = max (max (r, g), b)\r
+    rgb_min = min (min (r, g), b)\r
+    delta = rgb_max - rgb_min\r
+    hsl = [0.0, 0.0, 0.0]\r
+    hsl[2] = (rgb_max + rgb_min)/2.0\r
+    if delta == 0:\r
+        hsl[0] = 0.0\r
+        hsl[1] = 0.0\r
+    else:\r
+        if hsl[2] <= 0.5:\r
+            hsl[1] = delta / (rgb_max + rgb_min)\r
+        else:\r
+            hsl[1] = delta / (2 - rgb_max - rgb_min)\r
+        if r == rgb_max:\r
+            hsl[0] = (g - b) / delta\r
+        else:\r
+            if g == rgb_max:\r
+                hsl[0] = 2.0 + (b - r) / delta\r
+            else:\r
+                if b == rgb_max:\r
+                    hsl[0] = 4.0 + (r - g) / delta\r
+        hsl[0] = hsl[0] / 6.0\r
+        if hsl[0] < 0:\r
+            hsl[0] = hsl[0] + 1\r
+        if hsl[0] > 1:\r
+            hsl[0] = hsl[0] - 1\r
+    return hsl\r
+\r
+  def hue_2_rgb (self, v1, v2, h):\r
+    if h < 0:\r
+        h += 6.0\r
+    if h > 6:\r
+        h -= 6.0\r
+    if h < 1:\r
+        return v1 + (v2 - v1) * h\r
+    if h < 3:\r
+        return v2\r
+    if h < 4:\r
+        return v1 + (v2 - v1) * (4 - h)\r
+    return v1\r
+\r
+  def hsl_to_rgb (self,h, s, l):\r
+    rgb = [0, 0, 0]\r
+    if s == 0:\r
+        rgb[0] = l\r
+        rgb[1] = l\r
+        rgb[2] = l\r
+    else:\r
+        if l < 0.5:\r
+            v2 = l * (1 + s)\r
+        else:\r
+            v2 = l + s - l*s\r
+        v1 = 2*l - v2\r
+        rgb[0] = self.hue_2_rgb (v1, v2, h*6 + 2.0)\r
+        rgb[1] = self.hue_2_rgb (v1, v2, h*6)\r
+        rgb[2] = self.hue_2_rgb (v1, v2, h*6 - 2.0)\r
+    return rgb\r