コード例 #1
0
ファイル: base.py プロジェクト: moyogo/fontparts
    def transformBy(self, matrix, origin=None):
        """
        Transform the object.

            >>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
            >>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))

        **matrix** must be a :ref:`type-transformation`.
        **origin** defines the point at with the transformation
        should originate. It must be a :ref:`type-coordinate`
        or ``None``. The default is ``(0, 0)``.
        """
        matrix = normalizers.normalizeTransformationMatrix(matrix)
        if origin is None:
            origin = (0, 0)
        origin = normalizers.normalizeCoordinateTuple(origin)
        if origin is not None:
            t = transform.Transform()
            oX, oY = origin
            t = t.translate(oX, oY)
            t = t.transform(matrix)
            t = t.translate(-oX, -oY)
            matrix = tuple(t)
        self._transformBy(matrix)
コード例 #2
0
    def transformBy(self, matrix, origin=None):
        """
        Transform the object.

            >>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
            >>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))

        **matrix** must be a :ref:`type-transformation`.
        **origin** defines the point at with the transformation
        should originate. It must be a :ref:`type-coordinate`
        or ``None``. The default is ``(0, 0)``.
        """
        matrix = normalizers.normalizeTransformationMatrix(matrix)
        if origin is None:
            origin = (0, 0)
        origin = normalizers.normalizeCoordinateTuple(origin)
        if origin is not None:
            t = transform.Transform()
            oX, oY = origin
            t = t.translate(oX, oY)
            t = t.transform(matrix)
            t = t.translate(-oX, -oY)
            matrix = tuple(t)
        self._transformBy(matrix)
コード例 #3
0
 def _set_base_transformation(self, value):
     value = normalizers.normalizeTransformationMatrix(value)
     self._set_transformation(value)
コード例 #4
0
 def _get_base_transformation(self):
     value = self._get_transformation()
     value = normalizers.normalizeTransformationMatrix(value)
     return value
コード例 #5
0
ファイル: component.py プロジェクト: moyogo/fontparts
 def _set_base_transformation(self, value):
     value = normalizers.normalizeTransformationMatrix(value)
     self._set_transformation(value)
コード例 #6
0
ファイル: component.py プロジェクト: moyogo/fontparts
 def _get_base_transformation(self):
     value = self._get_transformation()
     value = normalizers.normalizeTransformationMatrix(value)
     return value