Ejemplo n.º 1
0
    def testShadowFX(self):
        def setParams(offset, radius, opacity, color):
            effect.offset = offset
            effect.radius = radius
            effect.opacity = opacity
            effect.color = color

        def setEffect(**kwargs):
            effect = avg.ShadowFXNode(**kwargs)
            self.node.setEffect(effect)

        root = self.loadEmptyScene()
        rect = avg.RectNode(parent=root, pos=(9.5, 9.5), color="0000FF")
        self.node = avg.ImageNode(parent=root, pos=(10, 10), href="shadow.png")
        rect.size = self.node.size + (1, 1)
        effect = avg.ShadowFXNode((0, 0), 1, 1, "FFFFFF")
        self.start(False, (
            self.skipIfMinimalShader,
            lambda: self.node.setEffect(effect),
            lambda: self.compareImage("testShadowFX1"),
            lambda: setParams((0, 0), 3, 2, "00FFFF"),
            lambda: self.compareImage("testShadowFX2"),
            lambda: setParams((2, 2), 0.1, 1, "FFFFFF"),
            lambda: self.compareImage("testShadowFX3"),
            lambda: setParams((-2, -2), 0.1, 1, "FFFFFF"),
            lambda: self.compareImage("testShadowFX4"),
            lambda: setParams((-2, -2), 3, 1, "FFFFFF"),
            lambda: self.compareImage("testShadowFX5"),
            lambda: setParams((0, 0), 0, 1, "FFFFFF"),
            lambda: self.compareImage("testShadowFX6"),
            lambda: setEffect(
                offset=(0, 0), radius=3, opacity=2, color="00FFFF"),
            lambda: self.compareImage("testShadowFX2"),
            lambda: setEffect(
                offset=(2, 2), radius=0.1, opacity=1, color="FFFFFF"),
            lambda: self.compareImage("testShadowFX3"),
            lambda: setEffect(
                offset=(-2, -2), radius=0.1, opacity=1, color="FFFFFF"),
            lambda: self.compareImage("testShadowFX4"),
            lambda: setEffect(
                offset=(-2, -2), radius=3, opacity=1, color="FFFFFF"),
            lambda: self.compareImage("testShadowFX5"),
            lambda: setEffect(
                offset=(0, 0), radius=0, opacity=1, color="FFFFFF"),
            lambda: self.compareImage("testShadowFX6"),
        ))
Ejemplo n.º 2
0
    def testWordsShadowFX(self):

        def setParams(offset, radius, opacity, color):
            effect.offset = offset
            effect.radius = radius
            effect.opacity = opacity
            effect.color =  color

        root = self.loadEmptyScene()
        node = avg.WordsNode(parent=root, pos=(10,10), text="testtext", 
                font="Bitstream Vera Sans", variant="Roman")
        effect = avg.ShadowFXNode()
        setParams((0,0), 1.5, 1.5, "FF0000")
        self.start(True,
                (self.skipIfMinimalShader,
                 lambda: node.setEffect(effect),
                 lambda: self.compareImage("testWordsShadowFX1"),
                 lambda: setParams((2,2), 2, 2, "00FFFF"),
                 lambda: self.compareImage("testWordsShadowFX2"),
                ))
Ejemplo n.º 3
0
 def setEffect(**kwargs):
     effect = avg.ShadowFXNode(**kwargs)
     self.node.setEffect(effect)