Skip to content
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: applying multiple filters on iOS #2366

Merged
merged 2 commits into from
Jul 25, 2024
Merged

Conversation

jakex7
Copy link
Member

@jakex7 jakex7 commented Jul 24, 2024

Summary

Applying multiple FeColorFilter instances can cause unexpected behavior on iOS, likely due to a bug in CoreImage where the CIImage recipe isn't applied step by step as it should be. This fix ensures that the filter result is rendered after each application by converting the image to CGImage and then back to CIImage.

Test Plan

With this simple test, we can prove that these changes are working

<Svg height="200" width="200">
  <Filter id="filter">
    <FeColorMatrix type="matrix" values="78 -70 -7 0 0 -21 29 -7 0 0 -21 -70 0 0 0 0 0 0 1 0"/>
    <FeColorMatrix type="matrix" values="0.2126, 0.7152, 0.0722, 0, 0, 0.2126, 0.7152, 0.0722, 0, 0, 0.2126, 0.7152, 0, 0, 0, 0, 0, 0, 1, 0"/>
  </Filter>
  <Rect width="200" height="200" fill="red" filter="url(#filter)"/>
</Svg>
Web iOS before changes iOS after changes
image image image

@jakex7 jakex7 merged commit 00e492e into main Jul 25, 2024
4 of 5 checks passed
@jakex7 jakex7 deleted the @jakex7/fixMultipleFiltersIos branch July 25, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant