Anonymous avatar Anonymous committed beb8a0f

load_xbm fixup

Comments (0)

Files changed (2)

 # BREAK = change breaks existing code
 # BUG   = fixed a bug that was crashing
 
+Apr 05, 2001
+	cursors.load_xbm work on images without hotspots
+
 Apr 03, 2001
 	swapped endian-ness for pixels_alpha()
 
     if type(mask) is type(''): mask = open(mask)
     curs = curs.readlines()
     mask = mask.readlines()
-    info = tuple([int(curs[x].split()[-1]) for x in range(4)])
-    data = ' '.join(curs[5:]).replace('};', '').replace(',', '')
+    #load width,height
+    width = int(curs[0].split()[-1])
+    height = int(curs[1].split()[-1])
+    #load hotspot position
+    if curs[2].startswith('#define'):
+        hotx = int(curs[2].split()[-1])
+        hoty = int(curs[3].split()[-1])
+    else:
+        hotx = hoty = 0
+
+    info = width, height, hotx, hoty    
+
+    for line in range(len(curs)):
+        if curs[line].startswith('static char'):
+            break
+    data = ' '.join(curs[line+1:]).replace('};', '').replace(',', '')
     cursdata = tuple([bitswap(int(x, 16)) for x in data.split()])
-    data = ' '.join(mask[5:]).replace('};', '').replace(',', '')
+
+    for line in range(len(mask)):
+        if mask[line].startswith('static char'):
+            break
+    data = ' '.join(mask[line+1:]).replace('};', '').replace(',', '')
     maskdata = tuple([bitswap(int(x, 16)) for x in data.split()])
     return info[:2], info[2:], cursdata, maskdata
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.