Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def RGBA8(self, data, (y, x)):
- ag = [0 for i in xrange(32)]
- rb = [0 for i in xrange(32)]
- out = [0 for i in xrange(x * y)]
- colors = 0
- colors2 = 0
- outp = 0
- inp = 0
- for i in xrange(0, y, 4):
- for j in xrange(0, x, 4):
- ofs = 0
- for k in xrange(4):
- off = min(x - j, 4)
- for sub in xrange(off):
- texel = Struct.uint16(data[inp:inp+2], endian='>')
- ag[colors] = (texel >> 8) & 0xFF
- rb[colors] = (texel >> 0) & 0xFF
- colors += 1
- out[colors2] = rb[] << 0 | ag[] << 8 | rb[] << 16 | ag[] << 24
- for colors2 in xrange(0, 32, 2)
- inp += 2
- ofs += x
- inp += 4 - off * 2
- outp += off
- outp += x * 3
- return ''.join(Struct.uint32(p) for p in out)
Add Comment
Please, Sign In to add comment