Beispiel #1
0
    def text_moveto(self, x, y, angle):
	if angle != None:
	    xcos = math.cos(basecanvas.to_radian(angle))
	    xsin = math.sin(basecanvas.to_radian(angle))
	    self.__write("%f %f %f %f %f %f Tm " % (xcos, xsin, -xsin, xcos, x, y))
	else:
	    self.__write("1 0 0 1 %f %f Tm " % (x, y))
Beispiel #2
0
    def __arcsub(self, x, y, radius, start, theta):
	xcos = math.cos(basecanvas.to_radian(theta))
	xsin = math.sin(basecanvas.to_radian(theta))
	x0 = radius * xcos
	y0 = radius * xsin
 	x1 = radius * (4-xcos)/3.0
 	y1 = radius * (1-xcos)*(xcos-3)/(3*xsin)

        xx0, xy0 = pychart_util.rotate(x0, y0, start+theta)
        xx1, xy1 = pychart_util.rotate(x1, -y1, start+theta)
        xx2, xy2 = pychart_util.rotate(x1, y1, start+theta)
	self.__write("%f %f %f %f %f %f c\n" %
		(x+xx1, y+xy1, x+xx2, y+xy2, x+xx0, y+xy0))
Beispiel #3
0
    def push_transformation(self, baseloc, scale, angle, in_text = 0):
        if in_text:
            op = "Tm"
        else:
            op = "cm"
            self.gsave()

        if baseloc == None:
            baseloc = (0,0)

        if angle != None:
            radian = basecanvas.to_radian(angle)
            self.__write("%f %f %f %f %f %f %s\n" %
                         (math.cos(radian), math.sin(radian),
                          -math.sin(radian), math.cos(radian),
                          baseloc[0], baseloc[1], op))
        if scale != None:
            self.__write("%f 0 0 %f %f %f %s\n" % (scale[0], scale[1],
                                                   baseloc[0],
                                                   baseloc[1], op))