def test_trs_factor(self): trans = affine.affine_identity() trans = affine.translate(trans, 6, 5) trans = affine.rotate(trans, 2.4) trans = affine.scale(trans, 0.2, 10) tx, ty, sx, sy, angle = affine.trs_factor(trans) assert ((tx, ty) == (6, 5)) assert ((sx, sy) == (0.2, 10)) assert (angle == 2.4)
def test_trs_factor(self): trans = affine.affine_identity() trans = affine.translate(trans,5,5) trans = affine.rotate(trans,2.4) trans = affine.scale(trans,10,10) tx,ty,sx,sy,angle = affine.trs_factor(trans) assert( (tx,ty) == (5,5)) assert( (sx,sy) == (10,10)) assert( angle == 2.4)
def device_show_text(self, text): ttm = self.get_text_matrix() ctm = self.get_ctm() # not device_ctm!! m = affine.concat(ctm,ttm) tx,ty,sx,sy,angle = affine.trs_factor(m) angle = angle * 180. / pi gc = self._backend.new_gc() text = unicode_to_mathtext(text) if self._backend.flipy(): ty = self.height() - ty self._backend.draw_text(gc, tx, ty - 1, text, self._font_prop, angle, ismath=True) gc.restore()
def device_show_text(self, text): ttm = self.get_text_matrix() ctm = self.get_ctm() # not device_ctm!! m = affine.concat(ctm, ttm) tx, ty, sx, sy, angle = affine.trs_factor(m) angle = angle * 180. / pi gc = self._backend.new_gc() text = unicode_to_mathtext(text) if self._backend.flipy(): ty = self.height() - ty self._backend.draw_text(gc, tx, ty - 1, text, self._font_prop, angle, ismath=True) gc.restore()