diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a70935c6..8e5db744 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,12 @@ name: Test -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: linux: diff --git a/CHANGES.rst b/CHANGES.rst index 0e9461d9..c641ca47 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +1.9.8 (2020-03-18) +------------------ + +- [composite] Fix incorrect fill opacity handling in compositing. +- [composite] Fix incorrect alpha for patterns. + 1.9.7 (2020-03-17) ------------------ diff --git a/src/psd_tools/composite/__init__.py b/src/psd_tools/composite/__init__.py index 00ea44b8..93b075d6 100644 --- a/src/psd_tools/composite/__init__.py +++ b/src/psd_tools/composite/__init__.py @@ -193,13 +193,16 @@ def apply(self, layer): shape_mask, opacity_mask = self._get_mask(layer) shape_const, opacity_const = self._get_const(layer) - shape *= shape_mask * shape_const - alpha *= (shape_mask * opacity_mask) * (shape_const * opacity_const) + shape *= shape_mask + alpha *= shape_mask * opacity_mask * opacity_const # TODO: Tag.BLEND_INTERIOR_ELEMENTS controls how inner effects apply. # TODO: Apply before effects - self._apply_source(color, shape, alpha, layer.blend_mode, knockout) + self._apply_source( + color, shape * shape_const, alpha * shape_const, layer.blend_mode, + knockout + ) # TODO: Apply after effects self._apply_color_overlay(layer, color, shape, alpha) diff --git a/src/psd_tools/composite/vector.py b/src/psd_tools/composite/vector.py index f13f9471..78449b55 100644 --- a/src/psd_tools/composite/vector.py +++ b/src/psd_tools/composite/vector.py @@ -219,7 +219,7 @@ def draw_pattern_fill(viewport, psd, desc): ) channels = EXPECTED_CHANNELS.get(pattern.image_mode) pixels = np.tile(panel, reps)[:height, :width, :] - if pixels.shape[2] >= channels: + if pixels.shape[2] > channels: return pixels[:, :, :channels], pixels[:, :, -1:] return pixels, None diff --git a/src/psd_tools/version.py b/src/psd_tools/version.py index 71e0d8eb..2015c15a 100644 --- a/src/psd_tools/version.py +++ b/src/psd_tools/version.py @@ -1 +1 @@ -__version__ = '1.9.7' +__version__ = '1.9.8' diff --git a/tests/psd_files/transparency/fill-opacity.psd b/tests/psd_files/transparency/fill-opacity.psd new file mode 100644 index 00000000..0f9c5ef6 Binary files /dev/null and b/tests/psd_files/transparency/fill-opacity.psd differ diff --git a/tests/psd_tools/composite/test_composite.py b/tests/psd_tools/composite/test_composite.py index 3df0a866..83d8d143 100644 --- a/tests/psd_tools/composite/test_composite.py +++ b/tests/psd_tools/composite/test_composite.py @@ -42,6 +42,7 @@ def check_composite_quality(filename, threshold=0.1, force=False): ('transparency/transparency-group.psd', ), ('transparency/knockout-isolated-groups.psd', ), ('transparency/clip-opacity.psd', ), + ('transparency/fill-opacity.psd', ), ]) def test_composite_quality(filename): check_composite_quality(filename, 0.01, False)