(self, x0, y0, sx, sy, plot, goback)
Make a DRAW step, drawing a line and returning if requested.
Make a DRAW step, drawing a line and returning if requested.
Make a DRAW step drawing a line and returning if requested .
def _draw_step(self, x0, y0, sx, sy, plot, goback):
        """Make a DRAW step, drawing a line and returning if requested."""
        scale = self._draw_scale
        rotate = self._draw_angle
        # pixel aspect ratio
        aspect = (
            self._mode.pixel_height * self._screen_aspect[0],
            self._mode.pixel_width * self._screen_aspect[1]
        )
        yfac = float(aspect[1]) / float(aspect[0])
        x1 = int(math.trunc(scale*sx / 4.))
        y1 = int(math.trunc(scale*sy / 4.))
        if rotate == 0 or rotate == 360:
            pass
        elif rotate == 90:
            x1, y1 = int(y1*yfac), -int(x1//yfac)
        elif rotate == 180:
            x1, y1 = -x1, -y1
        elif rotate == 270:
            x1, y1 = -int(y1*yfac), int(x1//yfac)
        else:
            fx, fy = float(x1), float(y1)
            # degrees to radians
            phi = rotate * math.pi / 180.
            sinr, cosr = math.sin(phi), math.cos(phi)
            x1 = cosr * fx + sinr*fy * yfac
            y1 = cosr * fy - sinr*fx / yfac
            x1, y1 = int(round(x1)), int(round(y1))
        y1 += y0
        x1 += x0
        if plot:
            self._draw_line(x0, y0, x1, y1, self._last_attr)
        self._last_point = x1, y1
        if goback:
            self._last_point = x0, y0
def _draw_step ( self , x0 , y0 , sx , sy , plot , goback ) : scale = self . _draw_scale rotate = self . _draw_angle # pixel aspect ratio aspect = ( self . _mode . pixel_height * self . _screen_aspect [ 0 ] , self . _mode . pixel_width * self . _screen_aspect [ 1 ] ) yfac = float ( aspect [ 1 ] ) / float ( aspect [ 0 ] ) x1 = int ( math . trunc ( scale * sx / 4. ) ) y1 = int ( math . trunc ( scale * sy / 4. ) ) if rotate == 0 or rotate == 360 : pass elif rotate == 90 : x1 , y1 = int ( y1 * yfac ) , - int ( x1 // yfac ) elif rotate == 180 : x1 , y1 = - x1 , - y1 elif rotate == 270 : x1 , y1 = - int ( y1 * yfac ) , int ( x1 // yfac ) else : fx , fy = float ( x1 ) , float ( y1 ) # degrees to radians phi = rotate * math . pi / 180. sinr , cosr = math . sin ( phi ) , math . cos ( phi ) x1 = cosr * fx + sinr * fy * yfac y1 = cosr * fy - sinr * fx / yfac x1 , y1 = int ( round ( x1 ) ) , int ( round ( y1 ) ) y1 += y0 x1 += x0 if plot : self . _draw_line ( x0 , y0 , x1 , y1 , self . _last_attr ) self . _last_point = x1 , y1 if goback : self . _last_point = x0 , y0