We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c47ff1f commit 46f3361Copy full SHA for 46f3361
package/src/skia/core/Paint.ts
@@ -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