Created
August 19, 2025 12:51
-
-
Save stevengoldberg/37e3b96de4360a6a39ac2b7040e8a4c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| ImageShader, | |
| Shader, | |
| FilterMode, | |
| MipmapMode, | |
| MitchellCubicSampling, | |
| TileMode, | |
| CatmullRomCubicSampling, | |
| Blur, | |
| Paint, | |
| Group, | |
| Fill, | |
| } from '@shopify/react-native-skia' | |
| export default function LUTImage({ | |
| lutImage, | |
| lutShader, | |
| uniforms, | |
| skImage, | |
| width, | |
| height, | |
| onscreen, | |
| blurValueSv = 0, | |
| fit = 'contain', | |
| x = 0, | |
| y = 0, | |
| }) { | |
| return ( | |
| <Group | |
| layer={ | |
| <Paint> | |
| <Blur blur={blurValueSv} mode="clamp" /> | |
| </Paint> | |
| } | |
| > | |
| <Fill /> | |
| <Shader source={lutShader} uniforms={uniforms}> | |
| <ImageShader | |
| image={skImage} | |
| fit={fit} | |
| rect={{ x, y, width, height }} | |
| sampling={ | |
| onscreen | |
| ? { | |
| filter: FilterMode.Linear, | |
| mipmap: MipmapMode.Linear, | |
| } | |
| : MitchellCubicSampling | |
| } | |
| /> | |
| {lutImage && ( | |
| <ImageShader | |
| image={lutImage} | |
| fit="none" | |
| rect={{ | |
| x: 0, | |
| y: 0, | |
| width: lutImage.width(), | |
| height: lutImage.height(), | |
| }} | |
| sampling={ | |
| onscreen | |
| ? { | |
| filter: FilterMode.Linear, | |
| mipmap: MipmapMode.None, | |
| } | |
| : CatmullRomCubicSampling | |
| } | |
| tileMode={TileMode.Clamp} | |
| /> | |
| )} | |
| </Shader> | |
| </Group> | |
| ) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment