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 clipRule in Android #1409 #1564

Merged
merged 2 commits into from
Apr 9, 2021
Merged

Fix clipRule in Android #1409 #1564

merged 2 commits into from
Apr 9, 2021

Conversation

magicismight
Copy link
Collaborator

Fix #1409

Summary

The clipRule prop should be used on graphics elements.
Not on ClipPath itself.

Test Plan

Run example in #1409

What's required for testing (prerequisites)?

None

What are the steps to reproduce (after prerequisites)?

#1409

Compatibility

OS Implemented
Android

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

@magicismight magicismight requested a review from msand April 9, 2021 07:25
@magicismight
Copy link
Collaborator Author

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/clip-rule

clipRule should be use inside ClipPath or with clipPath prop.

@magicismight
Copy link
Collaborator Author

magicismight commented Apr 9, 2021

I have removed _clipMask in RNSVG, It does not work in recent versions.
Nothing been draw on this _clipMask, it will cause bug when clipRule is nonzero

CGRect bounds = CGContextGetClipBoundingBox(context);
CGSize size = bounds.size;

UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
CGContextRef newContext = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(newContext, 0.0, size.height);
CGContextScaleCTM(newContext, 1.0, -1.0);

[_clipNode renderLayerTo:newContext rect:bounds];
_clipMask = CGBitmapContextCreateImage(newContext);
UIGraphicsEndImageContext();

Nothing drawed on this _clipMask

@magicismight magicismight merged commit fa9a25d into develop Apr 9, 2021
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.

ClipPath is not working properly on Android without clipRule prop
1 participant