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

Region.Op.REPLACE is deprecated in API level 28 #766

Closed
WoodyWoodsta opened this issue Aug 30, 2018 · 2 comments
Closed

Region.Op.REPLACE is deprecated in API level 28 #766

WoodyWoodsta opened this issue Aug 30, 2018 · 2 comments

Comments

@WoodyWoodsta
Copy link

When trying to use a clip path on an element, the use of Region.Op.REPLACE is causing an exception Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed. This is due to REPLACE being deprecated as per https://developer.android.com/reference/android/graphics/Canvas.html#clipPath(android.graphics.Path,%20android.graphics.Region.Op)

I would love to PR but I'm not clear on how to resolve this to be honest.

@msand
Copy link
Collaborator

msand commented Sep 1, 2018

If you need a quick fix then you can just remove the second argument: msand@a1097b8#diff-633cc935907e7685222b28cf9a0d7696L268
That's more spec conformant anyway.

@WoodyWoodsta
Copy link
Author

@msand Great stuff - this appears to work quite well. Will leave open until this is included upstream.

@msand msand closed this as completed in a1097b8 Sep 15, 2018
sivakumar-cf added a commit to curefit/react-native-svg that referenced this issue Sep 10, 2019
https://www.w3.org/TR/SVG11/masking.html#EstablishingANewClippingPath

The raw geometry of each child element exclusive of rendering properties such as ‘fill’, ‘stroke’, ‘stroke-width’ within a ‘clipPath’ conceptually defines a 1-bit mask (with the possible exception of anti-aliasing along the edge of the geometry) which represents the silhouette of the graphics associated with that element. Anything outside the outline of the object is masked out. If a child element is made invisible by ‘display’ or ‘visibility’ it does not contribute to the clipping path. When the ‘clipPath’ element contains multiple child elements, the silhouettes of the child elements are logically OR'd together to create a single silhouette which is then used to restrict the region onto which paint can be applied. Thus, a point is inside the clipping path if it is inside any of the children of the ‘clipPath’.

For a given graphics element, the actual clipping path used will be the intersection of the clipping path specified by its ‘clip-path’ property (if any) with any clipping paths on its ancestors, as specified by the ‘clip-path’ property on the ancestor elements, or by the ‘overflow’ property on ancestor elements which establish a new viewport. Also, see the discussion of the initial clipping path.)

Fixes issues highlighted by software-mansion#752
Fix software-mansion#280
Fix software-mansion#517

[android] Fix software-mansion#766
`Region.Op.REPLACE` is deprecated in API level 28
Replace with clipPath (Path path) to Intersect instead.
JackWillie added a commit to JackWillie/react-native-svg that referenced this issue Nov 27, 2022
https://www.w3.org/TR/SVG11/masking.html#EstablishingANewClippingPath

The raw geometry of each child element exclusive of rendering properties such as ‘fill’, ‘stroke’, ‘stroke-width’ within a ‘clipPath’ conceptually defines a 1-bit mask (with the possible exception of anti-aliasing along the edge of the geometry) which represents the silhouette of the graphics associated with that element. Anything outside the outline of the object is masked out. If a child element is made invisible by ‘display’ or ‘visibility’ it does not contribute to the clipping path. When the ‘clipPath’ element contains multiple child elements, the silhouettes of the child elements are logically OR'd together to create a single silhouette which is then used to restrict the region onto which paint can be applied. Thus, a point is inside the clipping path if it is inside any of the children of the ‘clipPath’.

For a given graphics element, the actual clipping path used will be the intersection of the clipping path specified by its ‘clip-path’ property (if any) with any clipping paths on its ancestors, as specified by the ‘clip-path’ property on the ancestor elements, or by the ‘overflow’ property on ancestor elements which establish a new viewport. Also, see the discussion of the initial clipping path.)

Fixes issues highlighted by software-mansion/react-native-svg#752
Fix software-mansion/react-native-svg#280
Fix software-mansion/react-native-svg#517

[android] Fix software-mansion/react-native-svg#766
`Region.Op.REPLACE` is deprecated in API level 28
Replace with clipPath (Path path) to Intersect instead.
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

No branches or pull requests

2 participants