예제 #1
0
 def __init__(self, path, scene, view_properties, **kwargs):
     # store important data references
     self.path = path
     self.scene = scene
     self.view_properties = view_properties
     # SVG document size, maybe TODO
     self.metrics = dict({
         'widthpx': 1052,
         'heightpx': 744
     })
     # SVG document handle
     self.svg = svg(width="%dpx" % self.metrics['widthpx'],
                    height="%dpx" % self.metrics['heightpx'])
     # Fonts and pens we use when drawing
     # SVG Text style
     filterShadow = filter(x="-.3", y="-.5", width=1.9, height=1.9)
     filtBlur = feGaussianBlur(stdDeviation="4")
     filtBlur.set_in("SourceAlpha")
     filtBlur.set_result("out1")
     filtOffset = feOffset()
     filtOffset.set_in("out1")
     filtOffset.set_dx(4)
     filtOffset.set_dy(-4)
     filtOffset.set_result("out2")
     filtMergeNode1 = feMergeNode()
     filtMergeNode1.set_in("out2")
     filtMergeNode2 = feMergeNode()
     filtMergeNode2.set_in("SourceGraphic")
     filtMerge = feMerge()
     filtMerge.addElement(filtMergeNode1)
     filtMerge.addElement(filtMergeNode2)
     filterShadow.addElement(
         filtBlur
     )  # here i get an error from python. It is not allowed to add a primitive filter
     filterShadow.addElement(filtOffset)
     filterShadow.addElement(filtMerge)
     filterShadow.set_id("filterShadow")
     d = defs()
     d.addElement(filterShadow)
     self.svg.addElement(d)
     # local flags
     self.shadowFlag = False
     # flag handling
     for key in kwargs:
         if key == 'shadow':
             self.shadowFlag = kwargs[key]
예제 #2
0
 def __init__(self, path, scene, view_properties, **kwargs):
     # store important data references
     self.path = path
     self.scene = scene
     self.view_properties = view_properties
     # SVG document size, maybe TODO
     self.metrics = dict({'widthpx':1052, 'heightpx':744});
     # SVG document handle
     self.svg = svg(width="%dpx" % self.metrics['widthpx'], height="%dpx" % self.metrics['heightpx'])
     # Fonts and pens we use when drawing
     # SVG Text style
     filterShadow = filter(x="-.3",y="-.5", width=1.9, height=1.9)
     filtBlur = feGaussianBlur(stdDeviation="4")
     filtBlur.set_in("SourceAlpha")
     filtBlur.set_result("out1")
     filtOffset = feOffset()
     filtOffset.set_in("out1")
     filtOffset.set_dx(4)
     filtOffset.set_dy(-4)
     filtOffset.set_result("out2")
     filtMergeNode1 = feMergeNode()
     filtMergeNode1.set_in("out2")
     filtMergeNode2 = feMergeNode()
     filtMergeNode2.set_in("SourceGraphic")
     filtMerge = feMerge()
     filtMerge.addElement(filtMergeNode1)
     filtMerge.addElement(filtMergeNode2)
     filterShadow.addElement(filtBlur) # here i get an error from python. It is not allowed to add a primitive filter
     filterShadow.addElement(filtOffset)
     filterShadow.addElement(filtMerge)
     filterShadow.set_id("filterShadow")
     d=defs()
     d.addElement(filterShadow)
     self.svg.addElement(d)
     # local flags
     self.shadowFlag = False
     # flag handling
     for key in kwargs:
         if key == 'shadow':
             self.shadowFlag = kwargs[key]
예제 #3
0
파일: testFilter.py 프로젝트: J-VARO/linux
l1.set_id("nase")
p1 = path("M 13 26 A 5 3 0 0 0 27 26")
p1.set_id("mund")
p1.set_stroke("black")
p1.set_stroke_width("2")
p1.set_fill("none")

mySymbol = symbol()
mySymbol.set_id("smilie")
mySymbol.addElement(c1)
mySymbol.addElement(c2)
mySymbol.addElement(c3)
mySymbol.addElement(l1)
mySymbol.addElement(p1)

filter6 = filter(x="-.3",y="-.5", width=1.9, height=1.9)
filtBlur = feGaussianBlur(stdDeviation="4")
filtBlur.set_in("SourceAlpha")
filtBlur.set_result("out1")
filtOffset = feOffset()
filtOffset.set_in("out1")
filtOffset.set_dx(4)
filtOffset.set_dy(-4)
filtOffset.set_result("out2")

filtMergeNode1 = feMergeNode()
filtMergeNode1.set_in("out2")

filtMergeNode2 = feMergeNode()
filtMergeNode2.set_in("SourceGraphic")
filtMerge = feMerge()