add jpg support. Please note that 32bit bitmaps require 4x the memory of 8bit, possib...
[enigma2.git] / lib / python / Tools / LoadPixmap.py
index 033b843..b7838a3 100644 (file)
@@ -1,7 +1,15 @@
-from enigma import loadPNG
+from enigma import loadPNG, loadJPG
 
 def LoadPixmap(path, desktop = None):
-       ptr = loadPNG(path)
+       if path[-4:] == ".png":
+               ptr = loadPNG(path)
+       elif path[-4:] == ".jpg":
+               ptr = loadJPG(path)
+       elif path[-1:] == ".":
+               alpha = loadPNG(path + "a.png")
+               ptr = loadJPG(path + "rgb.jpg", alpha)
+       else:
+               raise "neither .png nor .jpg, please fix file extension"
        if ptr and desktop:
                desktop.makeCompatiblePixmap(ptr)
        return ptr