Esempio n. 1
0
 def __init__(self, wsize, threshold_min, threshold_max, thicknessMin, thicknessMax):
     StrokeShader.__init__(self)
     self._func = DensityF0D(wsize)
     self.threshold_min = threshold_min
     self.threshold_max = threshold_max
     self._thicknessMin = thicknessMin
     self._thicknessMax = thicknessMax
Esempio n. 2
0
    def shade(self, stroke):
        n = stroke.stroke_vertices_size()
        i = 0
        it = stroke.stroke_vertices_begin()
        func = DensityF0D(self.wsize)
        while not it.is_end:
            c = func(Interface0DIterator(it))
            if c < self.threshold_min:
                c = self.threshold_min
            if c > self.threshold_max:
                c = self.threshold_max
##          t = (c - self.threshold_min)/(self.threshold_max - self.threshold_min)*(self._thicknessMax-self._thicknessMin) + self._thicknessMin
            t = (self.threshold_max - c  )/(self.threshold_max - self.threshold_min)*(self._thicknessMax-self._thicknessMin) + self._thicknessMin
            it.object.attribute.thickness = (t/2.0, t/2.0)
            i = i+1
            it.increment()