coloreffect.py revision 636c2c493e706e71318b902b762aeb9086f60766
'''
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
'''
color_props_stroke=('stroke:',)
else:
if node.hasChildNodes():
if node.hasAttributes():
if style!='':
#inkex.debug('old style:'+style)
#inkex.debug('new style:'+';'.join(styles))
'''
def changeStyle(self,node):
if node.hasAttributes():
sa=node.getAttribute('style')
if sa!='':
debug(sa)
styles=simplestyle.parseStyle(sa)
for c in range(len(colortags)):
if colortags[c] in styles.keys():
styles[colortags[c]]=self.process_prop(styles[colortags[c]])
node.setAttribute('style',simplestyle.formatStyle(styles))
'''
#debug('got:'+col)
#debug('made:'+col)
#inkex.debug('ID:' + id )
return col
if node.hasAttributes():
# prevent multiple processing of the same gradient if it is used by more than one selected object
#inkex.debug("already had: " + this_id)
return
#inkex.debug("visited: " + str(self.visited))
if node.hasChildNodes():
if node.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