Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/CImage.py
blob: 7630c15a5f7c99d8fd959e5eb304ce9d4298969b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pygame

# ------------------------------------------------------------------------------
# loadImage().
# Loads an image.
#
# Parameters:
# aImageFilename: Image file path to load.
# aIsTransparent: If the image is transparent (True) or not (True, by default).
#
# Returns: The loaded image. 
# ------------------------------------------------------------------------------
def loadImage(aImageFilename, aIsTransparent = True):

    try: image = pygame.image.load(aImageFilename)
    except pygame.error, message:
        raise SystemExit, message

    if aIsTransparent:
        image = image.convert_alpha()

        # TODO: This is doubt... (taken from a tutorial), don't work?
        #image = image.convert()
        #color = image.get_at((0,0))
        #image.set_colorkey(color, RLEACCEL)
    else:
        image = image.convert()
        
    return image