coloreffect.py revision 80a6f8321e8b2d512ba522d460380739a07ee07d
'''
Copyright (C) 2006 Jos Hirth, kaioa.com
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
import random
color_props_stroke=('stroke:',)
else:
if node.hasChildNodes():
if node.hasAttributes():
if style!='':
#inkex.debug('old style:'+style)
#inkex.debug('new style:'+';'.join(styles))
#debug('got:'+col)
#debug('made:'+col)
#inkex.debug('ID:' + id )
return col
#if node.hasAttributes():
#this_id=node.getAttribute('id')
#if this_id in self.visited:
## prevent multiple processing of the same gradient if it is used by more than one selected object
##inkex.debug("already had: " + this_id)
#return
#self.visited.append(this_id)
#inkex.debug("visited: " + str(self.visited))
if newnode.hasChildNodes():
if newnode.hasAttributes():
#inkex.debug('ID:' + id )
pass
def rgb_to_hsl(self,r, g, b):
if delta == 0:
else:
else:
if r == rgb_max:
else:
if g == rgb_max:
else:
if b == rgb_max:
return hsl
if h < 0:
h += 6.0
if h > 6:
h -= 6.0
if h < 1:
if h < 3:
return v2
if h < 4:
return v1
def hsl_to_rgb (self,h, s, l):
if s == 0:
rgb[0] = l
rgb[1] = l
rgb[2] = l
else:
if l < 0.5:
v2 = l * (1 + s)
else:
v2 = l + s - l*s
return rgb