def __init__(self, width, height, loop=0, bg_color=None): """ Parameters ---------- :width & height: size of the image in pixels. :loop: number of loops of the image. :bg_color: background color index. """ self.width = width self.height = height self.loop = loop self.palette = None self._io = BytesIO() if bg_color is not None: self.write(encoder.rectangle(0, 0, width, height, bg_color))
def paint(self, *args): """Paint a rectangular region in the surface.""" self._gif_surface.write(encoder.rectangle(*args))