def test_blt(self): source = ImageRGBA(300, 200) dest = ImageRGBA(300, 200) sa, spitch = source.address_info() da, dpitch = dest.address_info() draw_rect(source, 120, 130, 10, 8, 130, 120, 150, 180) blt_rect(sa, 120, 130, 10, 8, spitch, da, 180, 190, dpitch, fliped=False) self._check_values(dest, 180, 190, 10, 8, 130, 120, 150, 180) blt_rect(sa, 120, 130, 10, 8, spitch, da, 50, 60, dpitch, fliped=False) self._check_values(dest, 50, 60, 10, 8, 130, 120, 150, 180)
def show_image_in_window(image, title=None, fliped=False): """ Create window and show image. @param image - image to show @param title - text that will be shown in title bar of window @param fliped - flip image vertical """ if title is None: title = "UnknownImage" if isinstance(image, ImageRGBA): image = image.to_bgra() assert isinstance(image, ImageBGRA) width, height = image.size() win = Window(width+20, height+20, title) da, dpitch = win.address_info() sa, spitch = image.address_info() blt_rect(sa, 0, 0, width, height, spitch, da, 0, 0, dpitch, fliped) win.redraw() main_loop()