Show
Ignore:
Timestamp:
12/21/07 14:11:13 (13 months ago)
Author:
fdb
Message:

- Colors are clamped
- Remember last opened directory

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nodebox/branches/try-qt/nodebox/graphics/qt.py

    r284 r286  
    584584    def _normalize(self, v): 
    585585        """Bring the color into the 0-1 scale for the current colorrange""" 
    586         return v / self._ctx._colorrange 
     586        return clamp(v / self._ctx._colorrange) 
    587587 
    588588    def _normalizeList(self, lst): 
    589589        """Bring the color into the 0-1 scale for the current colorrange""" 
    590         return map(lambda x:x / self._ctx._colorrange, lst) 
     590        return map(lambda x:clamp(x / self._ctx._colorrange), lst) 
    591591 
    592592color = Color 
     593 
     594def clamp(v): 
     595    return max(min(v, 1.0), 0.0) 
    593596 
    594597class Transform(object):