Skip to main content

Offset

This offset filter is identical to its SVG counterpart. It allows offsetting the filtered image.

NameTypeDescription
xnumberOffset along the X axis.
ynumberOffset along the Y axis.
children?ImageFilterOptional image filter to be applied first.

Example

tsx
import { Canvas, Image, Offset, useImage, Fill } from "@shopify/react-native-skia";
 
const Filter = () => {
const image = useImage(require("./assets/oslo.jpg"));
if (!image) {
return null;
}
return (
<Canvas style={{ width: 256, height: 256 }}>
<Fill color="lightblue" />
<Image
image={image}
x={0}
y={0}
width={256}
height={256}
fit="cover"
>
<Offset x={64} y={64} />
</Image>
</Canvas>
);
};
tsx
import { Canvas, Image, Offset, useImage, Fill } from "@shopify/react-native-skia";
 
const Filter = () => {
const image = useImage(require("./assets/oslo.jpg"));
if (!image) {
return null;
}
return (
<Canvas style={{ width: 256, height: 256 }}>
<Fill color="lightblue" />
<Image
image={image}
x={0}
y={0}
width={256}
height={256}
fit="cover"
>
<Offset x={64} y={64} />
</Image>
</Canvas>
);
};