4 # 2011 - Tomas Gavenciak <gavento@ucw.cz>
10 class PixelSize(object):
11 def __init__(self
, size
, bit_endian
=None, suffix
=None):
15 self
.bit_endian
= bit_endian
16 assert self
.bit_endian
in [None, LE
, BE
]
17 assert (bit_endian
is not None) == self
.needs_bit_endian()
18 self
.bit_endian_const
= "GP_BIT_ENDIAN_" + (self
.bit_endian
or LE
)
23 self
.suffix
= "INVALID"
26 self
.suffix
= '%dBPP_%s' % (size
, bit_endian
)
28 self
.suffix
= '%dBPP' % (size
,)
30 def needs_bit_endian(self
):
31 return (self
.size
% 8) != 0
33 def description(self
):
35 return "pixel size %d, bit endian %s, suffix %s" % (self
.size
,
36 self
.bit_endian
, self
.suffix
)
38 return "pixel size %d, suffix %s" % (self
.size
, self
.suffix
)