how to use react-native-skia as backend #1359
-
Hi, can I use Skia to create/modify an "art" image and save it to file without showing it up? |
Beta Was this translation helpful? Give feedback.
Answered by
wcandillon
Feb 15, 2023
Replies: 1 comment 7 replies
-
We support gpu accelerated offscreen rendering but we don't have a public API for it yet. const offscreen = Skia.Surface.MakeOffscreen(ctx.width, ctx.height);
if (!offscreen) {
throw new Error("Couldn't load the image");
}
const canvas = offscreen.getCanvas();
canvas.drawImage(....) // draw your image
// Draw
offscreen.flush();
// Get the image
offscreen.makeImageSnapshot() |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
hungtooc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We support gpu accelerated offscreen rendering but we don't have a public API for it yet.
Here are some relevant code snippets: https://github.com/Shopify/react-native-skia/blob/250cf9964fe2724961d09d2050554bc2361f3a45/package/src/renderer/__tests__/e2e/Offscreen.spec.tsx
Here is an example you could play with: