

def draw_image(self, viewer, dstarr, whence=0.0):
    if (self.image is None):
        return
    cache = self.get_cache(viewer)
    dst_order = viewer.get_rgb_order()
    image_order = self.image.get_order()
    if ((whence <= 0.0) or (cache.cutout is None) or (not self.optimize)):
        ((x0, y0), (x1, y1), (x2, y2), (x3, y3)) = viewer.get_pan_rect()
        xmin = int(min(x0, x1, x2, x3))
        ymin = int(min(y0, y1, y2, y3))
        xmax = int(max(x0, x1, x2, x3))
        ymax = int(max(y0, y1, y2, y3))
        (dst_x, dst_y) = (self.x, self.y)
        (a1, b1, a2, b2) = (0, 0, self.image.width, self.image.height)
        (dst_x, dst_y, a1, b1, a2, b2) = trcalc.calc_image_merge_clip(xmin, ymin, xmax, ymax, dst_x, dst_y, a1, b1, a2, b2)
        if (((a2 - a1) <= 0) or ((b2 - b1) <= 0)):
            return
        (scale_x, scale_y) = viewer.get_scale_xy()
        (_scale_x, _scale_y) = ((scale_x * self.scale_x), (scale_y * self.scale_y))
        res = self.image.get_scaled_cutout(a1, b1, a2, b2, _scale_x, _scale_y, method=self.interpolation)
        cache.cutout = res.data
        (pan_x, pan_y) = viewer.get_pan()
        pan_off = viewer.data_off
        (pan_x, pan_y) = ((pan_x + pan_off), (pan_y + pan_off))
        (off_x, off_y) = ((dst_x - pan_x), (dst_y - pan_y))
        off_x *= scale_x
        off_y *= scale_y
        (ht, wd, dp) = dstarr.shape
        cache.cvs_x = int(round(((wd / 2.0) + off_x)))
        cache.cvs_y = int(round(((ht / 2.0) + off_y)))
    trcalc.overlay_image(dstarr, cache.cvs_x, cache.cvs_y, cache.cutout, dst_order=dst_order, src_order=image_order, alpha=self.alpha, flipy=False)

dataset/ETHPy150Open ejeschke/ginga/ginga/canvas/types/image.py Image.draw_image/original