def read(cls, fp):
     version = read_fmt('I', fp)[0]
     signature, blend_mode = read_fmt('4s4s', fp)
     assert signature == b'8BIM', 'Invalid signature %r' % (signature)
     color = Color.read(fp)
     opacity, enabled = read_fmt('2B', fp)
     native_color = Color.read(fp)
     return cls(version, blend_mode, color, opacity, enabled, native_color)
 def read(cls, fp):
     # TODO: Check 4-byte = 2-byte int + 2-byte fraction?
     version, blur, intensity, angle, distance = read_fmt('IIIiI', fp)
     color = Color.read(fp)
     signature = read_fmt('4s', fp)[0]
     assert signature == b'8BIM', 'Invalid signature %r' % (signature)
     blend_mode = BlendMode(read_fmt('4s', fp)[0])
     enabled, use_global_angle, opacity = read_fmt('3B', fp)
     native_color = Color.read(fp)
     return cls(version, blur, intensity, angle, distance, color,
                blend_mode, enabled, use_global_angle, opacity,
                native_color)
 def read(cls, fp):
     version, blur, intensity, color, blend_mode, enabled, opacity = (
         cls._read_body(fp))
     native_color = None
     if version >= 2:
         native_color = Color.read(fp)
     return cls(version, blur, intensity, color, blend_mode, enabled,
                opacity, native_color)
 def read(cls, fp):
     version, blur, intensity, color, blend_mode, enabled, opacity = (
         cls._read_body(fp))
     invert, native_color = None, None
     if version >= 2:
         invert = read_fmt('B', fp)[0]
         native_color = Color.read(fp)
     return cls(version, blur, intensity, color, blend_mode, enabled,
                opacity, invert, native_color)
 def _read_body(cls, fp):
     # TODO: Check 4-byte = 2-byte int + 2-byte fraction?
     version, blur, intensity = read_fmt('III', fp)
     color = Color.read(fp)
     signature = read_fmt('4s', fp)[0]
     assert signature == b'8BIM', 'Invalid signature %r' % (signature)
     blend_mode = BlendMode(read_fmt('4s', fp)[0])
     enabled, opacity = read_fmt('2B', fp)
     return version, blur, intensity, color, blend_mode, enabled, opacity
 def read(cls, fp):
     # TODO: Check 4-byte = 2-byte int + 2-byte fraction?
     version, angle, depth, blur = read_fmt('Ii2I', fp)
     signature, highlight_blend_mode = read_fmt('4s4s', fp)
     assert signature == b'8BIM', 'Invalid signature %r' % (signature)
     signature, shadow_blend_mode = read_fmt('4s4s', fp)
     assert signature == b'8BIM', 'Invalid signature %r' % (signature)
     highlight_color = Color.read(fp)
     shadow_color = Color.read(fp)
     bevel_style, highlight_opacity, shadow_opacity = read_fmt('3B', fp)
     enabled, use_global_angle, direction = read_fmt('3B', fp)
     real_highlight_color, real_shadow_color = None, None
     if version == 2:
         real_highlight_color = Color.read(fp)
         real_shadow_color = Color.read(fp)
     return cls(version, angle, depth, blur, highlight_blend_mode,
                shadow_blend_mode, highlight_color, shadow_color,
                bevel_style, highlight_opacity, shadow_opacity, enabled,
                use_global_angle, direction, real_highlight_color,
                real_shadow_color)
示例#7
0
 def read(cls, fp, **kwargs):
     kind, is_open, flags, optional_blocks = read_fmt('4s2BH', fp)
     icon_location = read_fmt('4i', fp)
     popup_location = read_fmt('4i', fp)
     color = Color.read(fp)
     author = read_pascal_string(fp, 'macroman', padding=2)
     name = read_pascal_string(fp, 'macroman', padding=2)
     mod_date = read_pascal_string(fp, 'macroman', padding=2)
     length, marker = read_fmt('I4s', fp)
     data = read_length_block(fp)
     return cls(kind, is_open, flags, optional_blocks, icon_location,
                popup_location, color, author, name, mod_date, marker, data)
示例#8
0
 def read(cls, fp, **kwargs):
     color = Color.read(fp)
     opacity, flag = read_fmt('HBx', fp)
     return cls(color, opacity, flag)
示例#9
0
 def read(cls, fp, **kwargs):
     color = Color.read(fp)
     opacity = read_fmt('H', fp)[0]
     return cls(color, opacity)