Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/api/Image.py
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2012-02-26 23:21:30 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2012-02-26 23:21:30 (GMT)
commit02de66e7d3403af17113b7d7e674eb4bcb96278d (patch)
tree1ae053e2bbd1a15cf5c2381c9ac4adc276259724 /src/api/Image.py
parent54e57e7ba5ad7ae0508e6005c798db0a497e6578 (diff)
rename files of class - add losed permissions
Diffstat (limited to 'src/api/Image.py')
-rwxr-xr-xsrc/api/Image.py29
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