I want to draw a path on the given image using @shopify/reactnative-skia and then save the drawn part into an image
I want to draw a path on the given image using @shopify/reactnative-skia and then save the drawn part into an image as a clip but its not getting the correct clip image, here is the sample code;
const surface = Skia.Surface.MakeOffscreen(
canvasSize.width,
canvasSize.height
);
const currentCanvas = surface?.getCanvas();
const bounds = path.getBounds();
const paint = Skia.Paint();
paint.setAntiAlias(false);
currentCanvas?.drawImageRect(
image,
Skia.XYWHRect(0, 0, image.width(), image.height()),
Skia.XYWHRect(0, 0, canvasSize.width, canvasSize.height),
paint
);
currentCanvas?.save();
const clipImage = surface?.makeImageSnapshot(bounds);
canvasSize.width
and canvasSize.height
is the screen width and height.
And here is the base image:
And cut part size:
Via Active questions tagged javascript - Stack Overflow https://ift.tt/Z2g0THL
Comments
Post a Comment