Convert a SkShader to SkImage? #2658
Unanswered
wallysaurus
asked this question in
Q&A
Replies: 2 comments
-
I tried recreating the under-the-hood method shown here, and now it crashes the app any time I load. const createTexture = (image, time) => {
"worklet";
const surface = Skia.Surface.MakeOffscreen(width, height);
const canvas = surface.getCanvas();
canvas.drawPaint(Skia.RuntimeEffect.Make(WarpShader.source).makeShader([time]));
surface.flush();
image.value = surface.makeImageSnapshot();
}
export default UsernameCanvas = (props) => {
const inter = require('./Inter_600SemiBold.ttf');
const time = useClock();
const img = useSharedValue(null);
useEffect(() => {
runOnUI(createTexture)(img, time.value);
}, []);
} error:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
bumping this again... as its been a week with no answer. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been working on this for about a whole day now, I'm trying to convert my own custom noise shader (glsl/sksl) into an image which I can use for a displacement map. The only problem is whenever I try using the functions provided internally, such as
useTexture()
,drawOffscreen()
,makeImageSnapshot()
, andusePictureAsTexture()
, each one ends up with the same error:This is roughly how my shader is setup:
And I'm attempting to pass that image into here:
Is there any way I can possibly get a live updated shader to output to SkImage so that I can use it as a moving displacement map?
Beta Was this translation helpful? Give feedback.
All reactions