Beispiel #1
0
    def refreshCanvas(self):
        """
        create the canvas for this text layer on top of image layers.

        calls the base class refreshCanvas() method first

        :return Nothing: the text buffer is written to the Panel

        """

        # lay down background color/images etc first
        super(TextAnimBase, self).refreshCanvas()

        # text is drawn on the top of previous layers
        h, w = self.font.getFontBbox()

        x, y = self.origin if self.origin is not None else (0, 0)

        print "TextAnimbase.refreshCanvas() origin", self.origin

        if self.bottomLeftOrigin:
            h, w = self.textBuffer.shape[:2]
            y = y - h

        # set alpha
        # textAlpha is in range 0->1.0
        # multiply current settings
        # no point bothering if alpha is zero
        if self.textAlpha > 0:
            # multiply all alphas by textAlpha to retain relative transparency
            im = self.textBuffer.copy()
            im[:, :, 3] = im[:, :, 3].astype(float) * self.textAlpha
            Panel.DrawImage(x, y, im)
Beispiel #2
0
    def _run(self):
        self.busy = True

        self.startTime = time.time()

        while self.busy:
            if time.time() - self.startTime >= self.duration:
                break

            self.Xpos = self.Xpos + self.xStep
            self.Ypos = self.Ypos + self.yStep

            Panel.DrawImage(self.Xpos, self.Ypos, self.img)

            # has no effect on speed
            time.sleep(self.loopDelay)

        self.busy = False