コード例 #1
0
    def scale(self, context, width, height):
        if not self.width:
            self.width = width

        if not self.height:
            self.height = height

        scale = Scale()
        scale.horizontal = self.width / float(width)
        scale.vertical = self.height / float(height)

        if scale.horizontal:
            context.scale(scale.horizontal, 1.0)
        else:
            scale.horizontal = 1

        if scale.vertical:
            context.scale(1.0, scale.vertical)
        else:
            scale.vertical = 1

        return (scale.horizontal, scale.vertical)
コード例 #2
0
ファイル: paper.py プロジェクト: Happy-Ferret/sanaviron
    def scale(self, context, width, height):
        if not self.width:
            self.width = width

        if not self.height:
            self.height = height

        scale = Scale()
        scale.horizontal = self.width / float(width)
        scale.vertical = self.height / float(height)

        if scale.horizontal:
            context.scale(scale.horizontal, 1.0)
        else:
            scale.horizontal = 1

        if scale.vertical:
            context.scale(1.0, scale.vertical)
        else:
            scale.vertical = 1

        return (scale.horizontal, scale.vertical)
コード例 #3
0
ファイル: text.py プロジェクト: jaliste/sanaviron.gtk-3
    def scale(self, context, width, height):
        if not self.width:
            self.width = width

        if not self.height:
            self.height = height

        scale = Scale()

        if width:
            scale.horizontal = self.width / width

        if height:
            scale.vertical = self.height / height

        if scale.horizontal:
            context.scale(scale.horizontal, 1.0)

        if scale.vertical:
            context.scale(1.0, scale.vertical)