-
Notifications
You must be signed in to change notification settings - Fork 201
Fix clipping #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix clipping #336
Conversation
|
I have made it so that clipping on to a pass through layer causes no clipping to occur, which is the same behavior as SAIv2 and CSP. However it seems like this is not correct according to Photoshop, because it's causing a test to fail where a layer is clipped onto a pass through group. |
|
I can probably add a flag to PSDImage for compatibility modes like |
|
@cromachina What would be the test to check the correctness? |
|
@kyamagu I don't have Photoshop so it's hard for me to confirm, but the test |
| self._record = data | ||
| self._layers = [] | ||
| self._tagged_blocks = None | ||
| self._compatibility_mode = CompatibilityMode.DEFAULT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is VersionInfo field in the resource section of a PSD file, that states the file creator like Adobe Photoshop. Perhaps this part should attempt at guessing the default compatibility mode.
from psd_tools.constants import Resource
version_info = psd.image_resources.get_data(Resource.VERSION_INFO)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try something like that in bit.
| from enum import Enum, IntEnum | ||
| from enum import Enum, IntEnum, auto | ||
|
|
||
| class CompatibilityMode(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably there should be fixture files to test those. Any possibility?
| layer._clip_layers = [] | ||
| layer._has_clip_target = True | ||
|
|
||
| def _compute_clipping_layers(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate if there is a short comment describing the behavior difference between tools
Fixes #325