def _decode_bevel_info(data): fp = io.BytesIO(data) version, angle, depth, blur = read_fmt("IiII", fp) highlight_blend_mode = _read_blend_mode(fp) shadow_blend_mode = _read_blend_mode(fp) highlight_color = decode_color(fp) shadow_color = decode_color(fp) bevel_style, highlight_opacity, shadow_opacity = read_fmt("3B", fp) enabled, use_global_angle, direction = read_fmt("3B", fp) real_highlight_color = None real_shadow_color = None if version == 2: real_highlight_color = decode_color(fp) real_shadow_color = decode_color(fp) return BevelInfo(version, bool(enabled), bevel_style, depth, direction, blur, angle, bool(use_global_angle), highlight_blend_mode, highlight_color, highlight_opacity, shadow_blend_mode, shadow_color, shadow_opacity, real_highlight_color, real_shadow_color)
def _decode_bevel_info(data): fp = io.BytesIO(data) version, angle, depth, blur = read_fmt("IiII", fp) highlight_blend_mode = _read_blend_mode(fp) shadow_blend_mode = _read_blend_mode(fp) highlight_color = decode_color(fp) shadow_color = decode_color(fp) bevel_style, highlight_opacity, shadow_opacity = read_fmt("3B", fp) enabled, use_global_angle, direction = read_fmt("3B", fp) real_highlight_color = None real_shadow_color = None if version == 2: real_highlight_color = decode_color(fp) real_shadow_color = decode_color(fp) return BevelInfo( version, bool(enabled), bevel_style, depth, direction, blur, angle, bool(use_global_angle), highlight_blend_mode, highlight_color, highlight_opacity, shadow_blend_mode, shadow_color, shadow_opacity, real_highlight_color, real_shadow_color )
def _decode_solid_fill_info(data): fp = io.BytesIO(data) version = read_fmt("I", fp)[0] blend_mode = _read_blend_mode(fp) color = decode_color(fp) opacity, enabled = read_fmt("2B", fp) native_color = decode_color(fp) return SolidFillInfo(version, bool(enabled), blend_mode, color, opacity, native_color)
def _decode_outer_glow_info(data): fp = io.BytesIO(data) version, blur, intensity = read_fmt("3I", fp) color = decode_color(fp) blend_mode = _read_blend_mode(fp) enabled, opacity = read_fmt("2B", fp) native_color = None if version == 2: native_color = decode_color(fp) return OuterGlowInfo(version, bool(enabled), blend_mode, opacity, color, intensity, blur, native_color)
def _decode_solid_fill_info(data): fp = io.BytesIO(data) version = read_fmt("I", fp)[0] blend_mode = _read_blend_mode(fp) color = decode_color(fp) opacity, enabled = read_fmt("2B", fp) native_color = decode_color(fp) return SolidFillInfo( version, bool(enabled), blend_mode, color, opacity, native_color )
def _decode_shadow_info(data): fp = io.BytesIO(data) version, blur, intensity, angle, distance = read_fmt("IIIiI", fp) color = decode_color(fp) blend_mode = _read_blend_mode(fp) enabled, use_global_angle, opacity = read_fmt("3B", fp) native_color = None if version == 2: native_color = decode_color(fp) return ShadowInfo(version, bool(enabled), blend_mode, color, opacity, angle, bool(use_global_angle), distance, intensity, blur, native_color)
def _decode_old_display_info(data): fp = io.BytesIO(data) return DisplayInfo( decode_color(fp), *(read_fmt("HB", fp)) )
def _decode_outer_glow_info(data): fp = io.BytesIO(data) version, blur, intensity = read_fmt("3I", fp) color = decode_color(fp) blend_mode = _read_blend_mode(fp) enabled, opacity = read_fmt("2B", fp) native_color = None if version == 2: native_color = decode_color(fp) return OuterGlowInfo( version, bool(enabled), blend_mode, opacity, color, intensity, blur, native_color )
def _decode_shadow_info(data): fp = io.BytesIO(data) version, blur, intensity, angle, distance = read_fmt("IIIiI", fp) color = decode_color(fp) blend_mode = _read_blend_mode(fp) enabled, use_global_angle, opacity = read_fmt("3B", fp) native_color = None if version == 2: native_color = decode_color(fp) return ShadowInfo( version, bool(enabled), blend_mode, color, opacity, angle, bool(use_global_angle), distance, intensity, blur, native_color )
def _decode_filter_mask(data): fp = io.BytesIO(data) return FilterMask(decode_color(fp), read_fmt("H", fp)[0])
def _decode_background_color(data): fp = io.BytesIO(data) return decode_color(fp)
def _decode_user_mask(data, **kwargs): fp = io.BytesIO(data) color = decode_color(fp) opacity, flag = read_fmt("H B", fp) return UserMask(color, opacity, flag)
def _decode_filter_mask(data, **kwargs): fp = io.BytesIO(data) color = decode_color(fp) opacity = read_fmt("H", fp)[0] return FilterMask(color, opacity)