Skip to content

Instantly share code, notes, and snippets.

@stevengoldberg
Created August 19, 2025 12:51
Show Gist options
  • Select an option

  • Save stevengoldberg/37e3b96de4360a6a39ac2b7040e8a4c3 to your computer and use it in GitHub Desktop.

Select an option

Save stevengoldberg/37e3b96de4360a6a39ac2b7040e8a4c3 to your computer and use it in GitHub Desktop.
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