Ignore:
Timestamp:
09/07/13 20:03:09 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Rebase:
38653762313739393431326233333734653035633935343036616563306630373334373163656437
Message:

Inventory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/mutators.py

    r519 r555  
    5858
    5959
     60class ImageCentre(Mutator):
     61    def __init__(self, size):
     62        super(ImageCentre, self).__init__(ImageCentre.centre, size)
     63
     64    @classmethod
     65    def centre(cls, image, size):
     66        if image.get_size() == size:
     67            return image
     68        surf = pygame.surface.Surface(size, pygame.locals.SRCALPHA, image)
     69        surf.blit(image, ((size[0] - image.get_width()) / 2,
     70                          (size[1] - image.get_height()) / 2))
     71        return surf
     72
     73
    6074def rotator(angle):
    6175    return Mutator(rotate, angle)
     76
     77
     78def scaler(size):
     79    return Mutator(scale, size)
    6280
    6381
Note: See TracChangeset for help on using the changeset viewer.