コード例 #1
0
ファイル: base.py プロジェクト: JohnChu/libavg
 def _renderImage(self, srcBmp, node, pos, size):
     canvas = player.createCanvas(id="stretch_canvas", size=size)
     img = avg.ImageNode(pos=pos, parent=canvas.getRootNode())
     img.setBitmap(srcBmp)
     canvas.render()
     node.setBitmap(canvas.screenshot())
     player.deleteCanvas("stretch_canvas")
コード例 #2
0
 def _renderImage(self, srcBmp, node, pos, size):
     canvas = player.createCanvas(id="stretch_canvas", size=size)
     img = avg.ImageNode(pos=pos, parent=canvas.getRootNode())
     img.setBitmap(srcBmp)
     canvas.render()
     node.setBitmap(canvas.screenshot())
     player.deleteCanvas("stretch_canvas")
コード例 #3
0
ファイル: keyboard.py プロジェクト: bluscr33n/libavg
 def __createImage(self, node, bmp, sizeFactor):
     canvas = player.createCanvas(id="keycanvas", size=self.size*sizeFactor)
     canvasImage = avg.ImageNode(pos=-self.pos*sizeFactor, parent=canvas.getRootNode())
     canvasImage.setBitmap(bmp)
     canvas.render()
     node.setBitmap(canvas.screenshot())
     player.deleteCanvas('keycanvas')
コード例 #4
0
ファイル: keyboard.py プロジェクト: gunawanw9/libavg
 def __createImage(self, node, bmp, sizeFactor):
     canvas = player.createCanvas(id="keycanvas",
                                  size=self.size * sizeFactor)
     canvasImage = avg.ImageNode(pos=-self.pos * sizeFactor,
                                 parent=canvas.getRootNode())
     canvasImage.setBitmap(bmp)
     canvas.render()
     node.setBitmap(canvas.screenshot())
     player.deleteCanvas('keycanvas')
コード例 #5
0
ファイル: OffscreenTest.py プロジェクト: derric/libavg
 def deleteCanvases():
     changeHRef("")
     firstNode.href = ""
     player.deleteCanvas("testcanvas1")
     #            self.assertException(lambda: changeHRef("canvas:testcanvas1"))
     changeHRef("canvas:testcanvas2")
     #            self.assertException(lambda: player.deleteCanvas("testcanvas2"))
     changeHRef("")
     player.deleteCanvas("testcanvas2")
コード例 #6
0
ファイル: OffscreenTest.py プロジェクト: lynxis/libavg
        def deleteCanvases():
            changeHRef("")
            firstNode.href = ""
            player.deleteCanvas("testcanvas1")
#            self.assertException(lambda: changeHRef("canvas:testcanvas1"))
            changeHRef("canvas:testcanvas2")
#            self.assertException(lambda: player.deleteCanvas("testcanvas2"))
            changeHRef("")
            player.deleteCanvas("testcanvas2")
コード例 #7
0
ファイル: OffscreenTest.py プロジェクト: yueyihua/libavg
    def testCanvasDependencies(self):
        def makeCircularRef():
            self.offscreen1.getElementByID(
                "test1").href = "canvas:offscreencanvas2"

        def makeSelfRef1():
            avg.ImageNode(href="canvas:offscreencanvas1",
                          parent=self.offscreen1.getRootNode())

        def makeSelfRef2():
            self.offscreen1.getElementByID(
                "test1").href = "canvas:offscreencanvas1"

        def createTwoCanvases():
            self.offscreen1 = self.__createOffscreenCanvas(
                "offscreencanvas1", False)
            self.offscreen2 = self.__createOffscreenCanvas(
                "offscreencanvas2", False)
            self.node = avg.ImageNode(parent=root,
                                      href="canvas:offscreencanvas1")
            node = self.offscreen1.getElementByID("test1")
            node.href = "canvas:offscreencanvas2"
            node.size = (80, 60)

        def exchangeCanvases():
            self.offscreen1.getElementByID("test1").href = "rgb24-65x65.png"
            self.offscreen2.getElementByID(
                "test1").href = "canvas:offscreencanvas1"
            self.node.href = "canvas:offscreencanvas2"

        def loadCanvasDepString():
            player.createCanvas(id="canvas1", size=(160, 120))
            canvas2 = player.createCanvas(id="canvas2", size=(160, 120))
            avg.ImageNode(href="canvas:canvas1", parent=canvas2.getRootNode())
            player.deleteCanvas('canvas2')
            player.deleteCanvas('canvas1')

        root = self.loadEmptyScene()
        createTwoCanvases()
        self.offscreen1.getElementByID("test1").href = ""
        self.offscreen1 = None
        self.offscreen2 = None
        self.node.href = ""
        self.node = None
        player.deleteCanvas("offscreencanvas1")
        player.deleteCanvas("offscreencanvas2")
        self.start(False, (
            createTwoCanvases,
            lambda: self.compareImage("testCanvasDependencies1"),
            exchangeCanvases,
            lambda: self.compareImage("testCanvasDependencies2"),
            lambda: self.assertRaises(avg.Exception, makeCircularRef),
            lambda: self.assertRaises(avg.Exception, makeSelfRef1),
            lambda: self.assertRaises(avg.Exception, makeSelfRef2),
            loadCanvasDepString,
        ))
コード例 #8
0
ファイル: slider.py プロジェクト: pararthshah/libavg-vaapi
 def __renderImage(self, srcBmp, node, offset):
     if self._orientation == Orientation.HORIZONTAL:
         pos = (-offset,0)
     else:
         pos = (0, -offset)
     canvas = player.createCanvas(id="accordion_canvas", size=node.size)
     img = avg.ImageNode(pos=pos, parent=canvas.getRootNode())
     img.setBitmap(srcBmp)
     canvas.render()
     node.setBitmap(canvas.screenshot())
     player.deleteCanvas("accordion_canvas")
コード例 #9
0
    def testCanvasDependencies(self):
        def makeCircularRef():
            self.offscreen1.getElementByID("test1").href = "canvas:offscreencanvas2"
            
        def makeSelfRef1():
            avg.ImageNode(href="canvas:offscreencanvas1", 
                    parent=self.offscreen1.getRootNode())

        def makeSelfRef2():
            self.offscreen1.getElementByID("test1").href = "canvas:offscreencanvas1"

        def createTwoCanvases():
            self.offscreen1 = self.__createOffscreenCanvas("offscreencanvas1", False)
            self.offscreen2 = self.__createOffscreenCanvas("offscreencanvas2", False)
            self.node = avg.ImageNode(parent=root, 
                    href="canvas:offscreencanvas1")
            node = self.offscreen1.getElementByID("test1")
            node.href = "canvas:offscreencanvas2"
            node.size = (80, 60)
            
        def exchangeCanvases():
            self.offscreen1.getElementByID("test1").href = "rgb24-65x65.png"
            self.offscreen2.getElementByID("test1").href = "canvas:offscreencanvas1"
            self.node.href = "canvas:offscreencanvas2"
            
        def loadCanvasDepString():
            player.createCanvas(id="canvas1", size=(160, 120))
            canvas2 = player.createCanvas(id="canvas2", size=(160, 120))
            avg.ImageNode(href="canvas:canvas1", parent=canvas2.getRootNode())
            player.deleteCanvas('canvas2')
            player.deleteCanvas('canvas1')

        root = self.loadEmptyScene()
        createTwoCanvases()
        self.offscreen1.getElementByID("test1").href = ""
        self.offscreen1 = None
        self.offscreen2 = None
        self.node.href = ""
        self.node = None
        player.deleteCanvas("offscreencanvas1")
        player.deleteCanvas("offscreencanvas2")
        self.start(False,
                (createTwoCanvases,
                 lambda: self.compareImage("testCanvasDependencies1"),
                 exchangeCanvases,
                 lambda: self.compareImage("testCanvasDependencies2"),
                 lambda: self.assertRaises(avg.Exception, makeCircularRef),
                 lambda: self.assertRaises(avg.Exception, makeSelfRef1),
                 lambda: self.assertRaises(avg.Exception, makeSelfRef2),
                 loadCanvasDepString,
                ))
コード例 #10
0
 def deleteCanvases():
     changeHRef("")
     firstNode.href = ""
     player.deleteCanvas("testcanvas1")
     self.assertRaises(avg.Exception, lambda: changeHRef("canvas:testcanvas1"))
     changeHRef("canvas:testcanvas2")
     self.assertRaises(avg.Exception, lambda: player.deleteCanvas("testcanvas2"))
     changeHRef("")
     player.deleteCanvas("testcanvas2")
     self.assertRaises(avg.Exception, lambda: player.deleteCanvas("foo"))
コード例 #11
0
 def deleteCanvases():
     changeHRef("")
     firstNode.href = ""
     player.deleteCanvas("testcanvas1")
     self.assertRaises(avg.Exception, lambda: changeHRef("canvas:testcanvas1"))
     changeHRef("canvas:testcanvas2")
     self.assertRaises(avg.Exception, lambda: player.deleteCanvas("testcanvas2"))
     changeHRef("")
     player.deleteCanvas("testcanvas2")
     self.assertRaises(avg.Exception, lambda: player.deleteCanvas("foo"))
コード例 #12
0
ファイル: OffscreenTest.py プロジェクト: dboesel/libavg
 def deleteCanvases():
     changeHRef("")
     firstNode.href = ""
     player.deleteCanvas("testcanvas1")
     self.assertRaises(RuntimeError, lambda: changeHRef("canvas:testcanvas1"))
     changeHRef("canvas:testcanvas2")
     self.assertRaises(RuntimeError, lambda: player.deleteCanvas("testcanvas2"))
     changeHRef("")
     player.deleteCanvas("testcanvas2")
     self.assertRaises(RuntimeError, lambda: player.deleteCanvas("foo"))
コード例 #13
0
ファイル: MultiWindowTest.py プロジェクト: derric/libavg
 def deleteCanvas():
     img1.unlink(True)
     img2.unlink(True)
     player.deleteCanvas("canvas")
コード例 #14
0
ファイル: OffscreenTest.py プロジェクト: yueyihua/libavg
 def loadCanvasDepString():
     player.createCanvas(id="canvas1", size=(160, 120))
     canvas2 = player.createCanvas(id="canvas2", size=(160, 120))
     avg.ImageNode(href="canvas:canvas1", parent=canvas2.getRootNode())
     player.deleteCanvas('canvas2')
     player.deleteCanvas('canvas1')
コード例 #15
0
ファイル: OffscreenTest.py プロジェクト: yueyihua/libavg
 def deleteCanvas():
     player.deleteCanvas("testcanvas")
     self.__offscreenCanvas = None
コード例 #16
0
 def deleteCanvas():
     player.deleteCanvas("testcanvas")
     self.__offscreenCanvas = None
コード例 #17
0
ファイル: MultiWindowTest.py プロジェクト: th3infinity/libavg
 def deleteCanvas():
     img1.unlink(True)
     img2.unlink(True)
     player.deleteCanvas("canvas")
コード例 #18
0
 def loadCanvasDepString():
     player.createCanvas(id="canvas1", size=(160, 120))
     canvas2 = player.createCanvas(id="canvas2", size=(160, 120))
     avg.ImageNode(href="canvas:canvas1", parent=canvas2.getRootNode())
     player.deleteCanvas('canvas2')
     player.deleteCanvas('canvas1')