# # extract icons from an icon file. # outputs rez # # See FTN $CA import sys import getopt import struct class Icon: # Icon: # uint16_t IconType ($8000 = color, $0000 = b/w) # uint16_t IconSize # uint16_t IconHeight # uint16_t IconWidth # uint18_t IconImage[height * width / 2] # uint18_t IconMask[height * width / 2] def __init__(self): self.type = 0 self.size = 0 self.height = 0 self.width = 0 self.image = [] self.mask = [] def unpack_from(self, buffer, offset): x = struct.unpack_from("> 1 data = buffer[offset:offset+size] self.image = [ data[x*width:(x+1)*width] for x in range(0, height)] offset += size data = buffer[offset:offset+size] self.mask = [ data[x*width:(x+1)*width] for x in range(0, height)] offset += size return offset class IconData: # uint16_t iDataLen # uint8_t iDataBoss[64] # uint8_t iDataName[16] # uint16_t iDataType # uint16_t iDataAux # Icon iDataBig # Icon iDataSmall # def __init__(self): self.len = 0 self.boss = "" self.name = "" self.type = 0 self.aux = 0 self.big = None self.small = None def unpack_from(self, buffer, offset): l, = struct.unpack_from("