import verse as v import string class vBitmap: def __init__(self): self.w = 0 self.h = 0 self.rgba = "" def setSize(self, w, h): self.w = w self.h = h self.rgba = [chr(0)]* self.w * self.h * 4 def setTile(self, x, y, pixels, channel): imgx = v.B_TILE_SIZE * x imgy = v.B_TILE_SIZE * y try: p = 0 for j in range(0, v.B_TILE_SIZE): for i in range(0, v.B_TILE_SIZE): index = (imgy+j)*self.w*4 + (imgx+i)*4 + channel self.rgba[index] = chr(pixels[p]) p = p + 1 except: print imgx+i, imgy+j, channel, "<>", print self.w, self.h def getString(self): return string.join(self.rgba, '')