コード例 #1
0
def _decode_resolution(data):
    h_res, h_res_unit, width_unit, v_res, v_res_unit, height_unit = unpack("4s HH 4s HH", data)

    h_res = decode_fixed_point_32bit(h_res)
    v_res = decode_fixed_point_32bit(v_res)

    return ResolutionInfo(h_res, h_res_unit, width_unit, v_res, v_res_unit, height_unit)
コード例 #2
0
def _decode_protected(data):
    flag = unpack("I", data)[0]
    return ProtectedSetting(
        bool(flag & 1),
        bool(flag & 2),
        bool(flag & 4),
    )
コード例 #3
0
def _decode_print_scale(data):
    style, x, y, scale = unpack("H3f", data)

    if not PrintScaleStyle.is_known(style):
        warnings.warn("Unknown print scale style (%s)" % style)

    return PrintScale(style, x, y, scale)
コード例 #4
0
def _decode_print_scale(data):
    style, x, y, scale = unpack("H3f", data)

    if not PrintScaleStyle.is_known(style):
        warnings.warn("Unknown print scale style (%s)" % style)

    return PrintScale(style, x, y, scale)
コード例 #5
0
ファイル: tagged_blocks.py プロジェクト: blancoberg/psd-tools
def _decode_protected(data):
    flag = unpack("I", data)[0]
    return ProtectedSetting(
        bool(flag & 1),
        bool(flag & 2),
        bool(flag & 4),
    )
コード例 #6
0
def _decode_resolution(data):
    h_res, h_res_unit, width_unit, v_res, v_res_unit, height_unit = unpack(
        "4s HH 4s HH", data)

    h_res = decode_fixed_point_32bit(h_res)
    v_res = decode_fixed_point_32bit(v_res)

    return ResolutionInfo(h_res, h_res_unit, width_unit, v_res, v_res_unit,
                          height_unit)
コード例 #7
0
def _decode_print_flags_info(data):
    return PrintFlagsInfo(*(unpack("HBxIh", data)))
コード例 #8
0
def _decode_print_flags(data):
    return PrintFlags(*(unpack("9?x", data)))
コード例 #9
0
ファイル: decoders.py プロジェクト: EvgenKo423/psd-tools
def boolean(data):
    return bool(unpack("?", data[:1])[0])
コード例 #10
0
def _decode_print_flags(data):
    return PrintFlags(*(unpack("9?x", data)))
コード例 #11
0
def _decode_pixel_aspect_ration(data):
    version = unpack("I", data[:4])[0]
    aspect = unpack("d", data[4:])[0]
    return PixelAspectRatio(version, aspect)
コード例 #12
0
 def decoder(data):
     return unpack(fmt, data)[0]
コード例 #13
0
ファイル: test_utils.py プロジェクト: zhenzi0322/psd-tools
def test_unpack(fmt, value, expected):
    assert unpack(fmt, value)[0] == expected
コード例 #14
0
ファイル: decoders.py プロジェクト: zacaoer/psd-tools2
 def decoder(data, **kwargs):
     return unpack(fmt, data)[0]
コード例 #15
0
ファイル: decoders.py プロジェクト: EvgenKo423/psd-tools
 def decoder(data):
     # truncating data if it's bigger...
     return unpack(fmt, data[:fmt_size])[0]
コード例 #16
0
def _decode_pixel_aspect_ration(data):
    version = unpack("I", data[:4])[0]
    aspect = unpack("d", data[4:])[0]
    return PixelAspectRation(version, aspect)
コード例 #17
0
def _decode_print_flags_info(data):
    return PrintFlagsInfo(*(unpack("HBxIh", data)))
コード例 #18
0
def _decode_print_flags(data):
    try:
        return PrintFlags(*(unpack("9?x", data)))
    except struct.error as e:
        warnings.warn("%s" % e)
        return data