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