Skip to content

Commit

Permalink
Merge pull request #211 from psd-tools/v1.9.8
Browse files Browse the repository at this point in the history
v1.9.8
  • Loading branch information
kyamagu committed Mar 18, 2020
2 parents e5537dc + b4f5065 commit bae95a7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Test

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
linux:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
9 changes: 6 additions & 3 deletions src/psd_tools/composite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/psd_tools/composite/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/psd_tools/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.9.7'
__version__ = '1.9.8'
Binary file added tests/psd_files/transparency/fill-opacity.psd
Binary file not shown.
1 change: 1 addition & 0 deletions tests/psd_tools/composite/test_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bae95a7

Please sign in to comment.