Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/api/Image.py
blob: 1c11c5784c8e8c5229884f37f27c17c0fe07c63d (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
30
# -*- coding: utf-8 -*-

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: verificar la flag RLEACCEL
        #image.set_colorkey(color, RLEACCEL)
    else:
        image = image.convert()
        
    return image