1
"""mac_image - Helper routines (hacks) for images"""
8
imgformat.macrgb16 : (16, 16, 3, 5),
11
def mkpixmap(w, h, fmt, data):
12
"""kludge a pixmap together"""
13
fmtinfo = _fmt_to_mac[fmt]
15
rv = struct.pack("lHhhhhhhlllhhhhlll",
16
id(data)+MacOS.string_id_to_buffer, # HACK HACK!!
22
fmtinfo[0], fmtinfo[1],
23
fmtinfo[2], fmtinfo[3],
25
## print 'Our pixmap, size %d:'%len(rv)
27
return Qd.RawBitMap(rv)
36
pixelType, pixelSize, \
38
planeBytes, pmTable, pmReserved \
39
= struct.unpack("lhhhhhhhlllhhhhlll", data)
40
print 'Base: 0x%x'%baseAddr
41
print 'rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes)
42
print 'rect: %d, %d, %d, %d'%(t, l, b, r)
43
print 'pmVersion: 0x%x'%pmVersion
44
print 'packing: %d %d'%(packType, packSize)
45
print 'resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000)
46
print 'pixeltype: %d, size %d'%(pixelType, pixelSize)
47
print 'components: %d, size %d'%(cmpCount, cmpSize)
48
print 'planeBytes: %d (0x%x)'%(planeBytes, planeBytes)
49
print 'pmTable: 0x%x'%pmTable
50
print 'pmReserved: 0x%x'%pmReserved
51
for i in range(0, len(data), 16):
54
print '%02.2x'%ord(data[i+j]),