def GetPixelColorsOfRects(self, rects: list) -> list:
rects2 = [(x, y, x + width, y + height) for x, y, width, height in rects]<EOL>left, top, right, bottom = zip(*rects2)<EOL>left, top, right, bottom = min(left), min(top), max(right), max(bottom)<EOL>width, height = right - left, bottom - top<EOL>allColors = self.GetPixelColorsOfRect(left, top, width, height)<EOL>colorsOfRects = []<EOL>for x, y, w, h in rects:<EOL><INDENT>x -= left<EOL>y -= top<EOL>colors = []<EOL>for row in range(h):<EOL><INDENT>colors.extend(allColors[(y + row) * width + x:(y + row) * width + x + w])<EOL><DEDENT>colorsOfRects.append(colors)<EOL><DEDENT>return colorsOfRects<EOL>
rects: a list of rects, such as [(0,0,10,10), (10,10,20,20),(x,y,width,height)].
Return list, a list whose elements are ctypes.Array which is an iterable array of int values in argb.