def mkpixmap(w, h, fmt, data): """kludge a pixmap together""" fmtinfo = _fmt_to_mac[fmt] rv = struct.pack( "lHhhhhhhlllhhhhlll", id(data) + MacOS.string_id_to_buffer, # HACK HACK!! w * 2 + 0x8000, 0, 0, h, w, 0, 0, 0, # XXXX? 72 << 16, 72 << 16, fmtinfo[0], fmtinfo[1], fmtinfo[2], fmtinfo[3], 0, 0, 0) ## print 'Our pixmap, size %d:'%len(rv) ## dumppixmap(rv) return Qd.RawBitMap(rv)
def mkbitmap(w, h, fmt, data): if fmt != imgformat.xbmpacked: raise imgformat.error, 'Incorrect format for mkbitmap: %s' % fmt rv = struct.pack("lhhhhh", id(data) + MacOS.string_id_to_buffer, (w + 7) / 8, 0, 0, h, w) return Qd.RawBitMap(rv)
def __init__(self): self.__dict__['data'] = '' self._header = struct.pack('lhhhhhhhlllhhhhlll', id(self.data) + MacOS.string_id_to_buffer, 0, 0, 0, 0, 0, 0, 0, 0, 4718592, 4718592, QuickDraw.RGBDirect, 16, 2, 5, 0, 0, 0) self.__dict__['_pm'] = Qd.RawBitMap(self._header)
def __init__(self): self.__dict__['data'] = '' self._header = struct.pack("lhhhhhhhlllhhhhlll", id(self.data)+MacOS.string_id_to_buffer, 0, # rowBytes 0, 0, 0, 0, # bounds 0, # pmVersion 0, 0, # packType, packSize 72<<16, 72<<16, # hRes, vRes QuickDraw.RGBDirect, # pixelType 16, # pixelSize 2, 5, # cmpCount, cmpSize, 0, 0, 0) # planeBytes, pmTable, pmReserved self.__dict__['_pm'] = Qd.RawBitMap(self._header)
def PixMap(self): "Return a QuickDraw PixMap corresponding to this data." if not self.__dict__['_pm']: self.__dict__['_pm'] = Qd.RawBitMap(self._header) return self.__dict__['_pm']
def PixMap(self): if not self.__dict__['_pm']: self.__dict__['_pm'] = Qd.RawBitMap(self._header) return self.__dict__['_pm']
"""mac_image - Helper routines (hacks) for images"""
"""PixMapWrapper - defines the PixMapWrapper class, which wraps an opaque