def add(self, img): '''Add an image to the atlas. This method will fail if the given image cannot be transferred directly to a texture (for example, if it is another texture). `SurfaceData` is the usual image type for this method. `AllocatorException` will be raised if there is no room in the atlas for the image. :Parameters: `img` : `AbstractSurface` The image to add. :rtype: `SurfaceRegion` :return: The region of the atlas containing the newly added image. ''' x, y = self.allocator.alloc(img.width, img.height) draw.blit_into(self.surface, img, x, y) region = self.surface.get_region(x, y, img.width, img.height) return region
def blit_into(self, surface, x, y, area=None): draw.blit_into(self, surface, x, y, area)