def loadCached():
try:
# TODO, rework to use app cache directory
img = QtGui.QImage()
if img.load("/tmp/shader.png"):
newimg = img.convertToFormat(QtGui.QImage.Format.Format_ARGB32)
shape = newimg.height(), newimg.width()
ptr = newimg.constBits()
# Extract the first channel
data = numpy.array(ptr, dtype=numpy.uint8).reshape(newimg.height(), newimg.width(), 4)[:,:,0].copy()
st = json.load(open("/tmp/shader.json","r"))
atlas = {}
for k, v in list(st.items()):
atlas[k] = AtlasEntry(v['w'], v['h'], v['sx'], v['sy'], v['tx'], v['ty'], v['l'], v['t'], v['hb'])
return atlas, data
except IOError:
pass
return None
评论列表
文章目录