Example #1
0
 def __init__(self, bitmap, grid=None, border=0, imgkey=None):
     if grid is None:
         w = _getdim(bitmap.width+border*2)
         h = _getdim(bitmap.height+border*2)
         grid = (w,h)
     self._grid = grid
     self._border = border
     self._images = []
     self._key = imgkey
     self._textures = TextureManager()
     self._cObj = _c.GridImage(*grid)
     self._split(bitmap)
Example #2
0
 def __init__(self, fontfile, pngfile=None, spacing=0, linespacing=0):
     """Open a previously created bitmap font"""
     if pngfile is None:
         pngfile = splitext(fontfile)[0] + ".png"
     f = open(fontfile, "rb")
     data = f.read()
     f.close()
     data = pickle.loads(data)
     f.close()
     self.chardict = {}
     self.bmpdict = {}
     self.texmgr = TextureManager()
     s = Bitmap.Load(open(pngfile, "rb"))
     for k, (x, y, w, h) in data.char_rects.iteritems():
         bmp = s.get_subbitmap(x, y, w, h)
         img = self.texmgr.add_image(bmp)
         img.hotspot.set(0, 1)
         self.chardict[k] = ImageInstance(img)
         self.bmpdict[k] = bmp
     self.linesize = data.linesize
     self.padding = data.padding
     self.spacing = spacing
     self.linespacing = linespacing
Example #3
0
 def __init__(self):
     self.images = {}
     self.patterns = {}
     self._texmgr = TextureManager()
     self.path = None