

def __iter__(self):
    rect = self._frame.canvas
    pixel = PixelViewPixel.__new__(PixelViewPixel)
    pixel.owner = self
    for y in range(rect.top, rect.bottom):
        with magick_try() as exc:
            q = lib.GetCacheViewAuthenticPixels(self._ptr, rect.left, y, rect.width, 1, exc.ptr)
        try:
            for x in range(rect.left, rect.right):
                try:
                    pixel._pixel = q
                    pixel._x = x
                    pixel._y = y
                    (yield pixel)
                finally:
                    pixel._pixel = ffi.NULL
                q += 1
        finally:
            with magick_try() as exc:
                assert lib.SyncCacheViewAuthenticPixels(self._ptr, exc.ptr)

dataset/ETHPy150Open eevee/sanpera/sanpera/pixel_view.py PixelView.__iter__/original