def test_invert(self):
     """ An matrix times its inverse should produce the identity matrix
     """
     a, b, c, d, tx, ty = 1, 2, 3, 4, 5, 6
     transform1 = affine.affine_from_values(a, b, c, d, tx, ty)
     transform2 = affine.invert(transform1)
     desired = affine.affine_identity()
     actual = dot(transform2, transform1)
     assert (alltrue((ravel(actual) - ravel(desired)) < 1e-6))
Пример #2
0
 def test_invert(self):
     """ An matrix times its inverse should produce the identity matrix
     """
     a,b,c,d,tx,ty = 1,2,3,4,5,6
     transform1 = affine.affine_from_values(a,b,c,d,tx,ty)
     transform2 = affine.invert(transform1)
     desired = affine.affine_identity()
     actual = dot(transform2,transform1)
     assert(alltrue( (ravel(actual) - ravel(desired)) < 1e-6 ))
Пример #3
0
    def set_ctm(self, transform):
        """ Set the coordinate transform matrix

        """
        # We have to do this by inverting the current state to zero it out,
        # then transform by desired transform, as Reportlab Canvas doesn't
        # provide a method to directly set the ctm.
        current = self.get_ctm()
        self.concat_ctm(affine.invert(current))
        self.concat_ctm(transform)
Пример #4
0
    def set_ctm(self, transform):
        """ Set the coordinate transform matrix

        """
        # We have to do this by inverting the current state to zero it out,
        # then transform by desired transform, as Reportlab Canvas doesn't
        # provide a method to directly set the ctm.
        current = self.get_ctm()
        self.concat_ctm(affine.invert(current))
        self.concat_ctm(transform)
def test_handling_text(gc):
    font = Font(face_name="Arial", size=32)
    gc.set_font(font)
    gc.translate_ctm(100.0, 100.0)
    gc.move_to(-5, 0)
    gc.line_to(5, 0)
    gc.move_to(0, 5)
    gc.line_to(0, -5)
    gc.move_to(0, 0)
    gc.stroke_path()
    txtRot = affine.affine_from_rotation(PI / 6)
    gc.set_text_matrix(txtRot)
    gc.show_text("Hello")
    txtRot = affine.invert(txtRot)
    gc.set_text_matrix(txtRot)
    gc.show_text("inverted")
Пример #6
0
def test_handling_text(gc):
    font = Font(face_name="Arial", size = 32)
    gc.set_font(font)
    gc.translate_ctm(100.0, 100.0)
    gc.move_to(-5,0)
    gc.line_to(5,0)
    gc.move_to(0,5)
    gc.line_to(0,-5)
    gc.move_to(0,0)
    gc.stroke_path()
    txtRot = affine.affine_from_rotation(PI/6)
    gc.set_text_matrix(txtRot)
    gc.show_text("Hello")
    txtRot = affine.invert(txtRot)
    gc.set_text_matrix(txtRot)
    gc.show_text("inverted")