diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2012-02-26 23:21:30 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2012-02-26 23:21:30 (GMT) |
commit | 02de66e7d3403af17113b7d7e674eb4bcb96278d (patch) | |
tree | 1ae053e2bbd1a15cf5c2381c9ac4adc276259724 /src/api/Image.py | |
parent | 54e57e7ba5ad7ae0508e6005c798db0a497e6578 (diff) |
rename files of class - add losed permissions
Diffstat (limited to 'src/api/Image.py')
-rwxr-xr-x | src/api/Image.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/api/Image.py b/src/api/Image.py new file mode 100755 index 0000000..7630c15 --- /dev/null +++ b/src/api/Image.py @@ -0,0 +1,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
\ No newline at end of file |