
# from whirlpinch.py class pixel_fetcher: def get_pixel(self, x, y): coloff = x % self.tile_width row = y / self.tile_height rowoff = y % self.tile_height return self.tile[coloff, rowoff] gimp.tile_cache_ntiles(2 * (self.width+63) / 64) pft = pixel_fetcher(drawable) for row in range(self.sel_y1, (y1 + y2) / 2 + 1): for col in range(x1, x2): pixel[0] = pft.get_pixel(ix, iy) pixel[1] = pft.get_pixel(ix+1, iy) pixel[2] = pft.get_pixel(ix, iy+1) pixel[3] = pft.get_pixel(ix+1, iy+1) [ ... ] for i in range(self.bpp): values[0] = ord(pixel[0][i]) values[1] = ord(pixel[1][i]) values[2] = ord(pixel[2][i]) values[3] = ord(pixel[3][i]) dest_rgn[self.sel_x1:self.sel_x2, row] = top_p dest_rgn[self.sel_x1:self.sel_x2, (self.sel_y2 - 1) - (row - self.sel_y1)] = bot_p