Pixelated image when using SkShader, SkRuntimeImageFilter and canvas scaling

210 vues
Accéder directement au premier message non lu

Robert Icusca

non lue,
17 mai 2022, 09:02:1017/05/2022
à skia-discuss
I'm drawing a image as a fill for a shape by converting the SkImage to an SkShader, using also a transform matrix so it can fit within the shape. I also apply some scale to the canvas and everything looks good. 

When I add a SkImageFilters::RuntimeShader image filter I get a pixelated image, even if the shader used shouldn't change anything. Please see: https://fiddle.skia.org/c/587e2eb957c7c5940ed8cbfc297b32fd

Something similar I get when using SkMatrixImageFilter: https://fiddle.skia.org/c/af553c062f412fd7616a96754e89bb96

Is this the expected result ? Is there any general recommendation about how  RuntimeShader  should be used ? I understand the issue can be avoided by not scaling the canvas or the shader but I would try to avoid going down this path. 

Other filters like Blur, Tile work as I expected.


William Candillon

non lue,
7 août 2023, 03:54:1107/08/2023
à skia-discuss
This is also our experience and we recommend our users to use super sampling: https://github.com/Shopify/react-native-skia/pull/1737/files#diff-33c9176aadc57001d710fe5597023caca0be18583471be7e878b0e7e0cfb67a5R55

I would also be curious to understand the reasoning of why this is necessary.

Kind regards,

William

John Stiles

non lue,
9 août 2023, 11:53:4809/08/2023
à skia-d...@googlegroups.com
I found a known bug which might explain this: https://g-issues.skia.org/issues/40044507


It seems like the workaround is to avoid transformations other than basic X/Y translation when using the runtime shader image filter.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/3f0d2f69-d274-418b-9afc-9fca636852b9n%40googlegroups.com.

William Candillon

non lue,
9 août 2023, 15:06:0609/08/2023
à skia-d...@googlegroups.com
Thank you for providing this context, this helps us to document the behaviour to our users.

Kind regards,

William

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/AF9owdQF9g8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/CANBPXuCVu9gScCf1kGrMbf%2BBZR%3D7eCUAvVDntrA5e%2BafKvJd8g%40mail.gmail.com.
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message