from enigma import loadPNG, loadJPG
-def LoadPixmap(path, desktop = None):
+pixmap_cache = {}
+
+def LoadPixmap(path, desktop = None, cached = False):
+ if path in pixmap_cache:
+ return pixmap_cache[path]
+
if path[-4:] == ".png":
ptr = loadPNG(path)
elif path[-4:] == ".jpg":
raise "neither .png nor .jpg, please fix file extension"
if ptr and desktop:
desktop.makeCompatiblePixmap(ptr)
+
+ if cached:
+ pixmap_cache[path] = ptr
+
return ptr