def blend_mode(self, value): if isinstance(value, BlendMode): self._record.blend_mode = value elif hasattr(BlendMode, value.upper()): self._record.blend_mode = getattr(BlendMode, value.upper()) else: self._record.blend_mode = BlendMode(value)
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 blend_mode(self, value): _value = BlendMode(value) if _value == BlendMode.PASS_THROUGH: self._record.blend_mode = BlendMode.NORMAL else: self._record.blend_mode = _value setting = self._setting if setting: setting.blend_mode = _value
def read(cls, fp, **kwargs): kind = SectionDivider(read_fmt('I', fp)[0]) signature, key = None, None if is_readable(fp, 8): signature = read_fmt('4s', fp)[0] assert signature == b'8BIM', 'Invalid signature %r' % signature key = BlendMode(read_fmt('4s', fp)[0]) sub_type = None if is_readable(fp, 4): sub_type = read_fmt('I', fp)[0] return cls(kind, signature=signature, key=key, sub_type=sub_type)
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 blend_mode(self, value): self._record.blend_mode = BlendMode(value)