예제 #1
0
    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
예제 #2
0
파일: atlas.py 프로젝트: kloptops/pyglame
    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
예제 #3
0
 def blit_into(self, surface, x, y, area=None):
     draw.blit_into(self, surface, x, y, area)
예제 #4
0
 def blit_into(self, surface, x, y, area=None):
     draw.blit_into(self, surface, x, y, area)