Skip to content

Commit 33430fb

Browse files
committed
Remove usePicture deprecation
1 parent 90db9fc commit 33430fb

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

package/src/mock/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export const Mock: typeof SkiaExports &
5353
useTypeface: Noop,
5454
useImage: Noop,
5555
useSVG: Noop,
56-
usePicture: Noop,
5756
createPicture: Noop,
5857
// 3. Point/Rect/Transform utilities
5958
vec,

package/src/skia/core/Picture.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
1-
import type { DependencyList } from "react";
2-
import { useMemo } from "react";
3-
41
import { Skia } from "../Skia";
52
import type { SkCanvas, SkRect } from "../types";
63

7-
/**
8-
* Memoizes and returns an SkPicture that can be drawn to another canvas.
9-
* @param rect Picture bounds
10-
* @param cb Callback for drawing to the canvas
11-
* @returns SkPicture
12-
*/
13-
export const usePicture = (
14-
rect: SkRect,
15-
cb: (canvas: SkCanvas) => void,
16-
deps: DependencyList = []
17-
) => {
18-
console.warn("usePicture() is deprecated. Use createPicture() instead.");
19-
return useMemo(() => {
20-
const recorder = Skia.PictureRecorder();
21-
const canvas = recorder.beginRecording(rect);
22-
cb(canvas);
23-
return recorder.finishRecordingAsPicture();
24-
// eslint-disable-next-line react-hooks/exhaustive-deps
25-
}, deps);
26-
};
27-
284
/**
295
* Memoizes and returns an SkPicture that can be drawn to another canvas.
306
* @param rect Picture bounds

0 commit comments

Comments
 (0)