Skip to content

Commit 46f3361

Browse files
committed
Add missing file
1 parent c47ff1f commit 46f3361

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

package/src/skia/core/Paint.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { DependencyList } from "react";
2+
import { useMemo } from "react";
3+
4+
import { Skia } from "../Skia";
5+
import type { SkPaint } from "../types";
6+
import { defaultSkiaPaint } from "../types/Paint/Paint";
7+
8+
export const SkiaPaint = () => defaultSkiaPaint(Skia.Paint());
9+
10+
/**
11+
* Returns a Skia Paint object
12+
* */
13+
export const usePaint = (
14+
initializer?: (paint: SkPaint) => void,
15+
deps?: DependencyList
16+
) =>
17+
useMemo(() => {
18+
const p = SkiaPaint();
19+
if (initializer) {
20+
initializer(p);
21+
}
22+
return p;
23+
// eslint-disable-next-line react-hooks/exhaustive-deps
24+
}, deps);

0 commit comments

Comments
 (0)